Part Number Hot Search : 
PS911 3386W253 K03B7 74447 GTG20N P6KE1 244MT L61H328
Product Description
Full Text Search
 

To Download MC68HC912BL16TS Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  order this document by MC68HC912BL16TS/d this document contains information on a new product. specifications and information herein are subject to change without notice. ?motorola inc., 1998 preliminary rev. 1 motorola semiconductor technical data mc68hc912bl16 technical summary 16-bit microcontroller 1 introduction the mc68hc912bl16 microcontroller unit (mcu) is a 16-bit device composed of standard on-chip pe- ripherals including a 16-bit central processing unit (cpu12), 16-kbyte flash eeprom, 512-byte ram, 512-byte eeprom, an asynchronous serial communications interface (sci), a serial peripheral inter- face (spi), an 7-channel timer and 16-bit pulse accumulator, an 10-bit analog-to-digital converter (adc), and a four-channel pulse-width modulator (pwm). system resource mapping, clock generation, interrupt control and bus interfacing are managed by the lite integration module (lim). the mc68hc912bl16 has full 16-bit data paths throughout, however, the multiplexed external bus can op- erate in an 8-bit narrow mode so single 8-bit wide memory can be interfaced for lower cost systems. 1.1 features ?16-bit cpu12 ?upward compatible with m68hc11 instruction set ?interrupt stacking and programmer? model identical to m68hc11 ?20-bit alu ?instruction queue ?enhanced indexed addressing ?fuzzy logic instructions ?multiplexed bus ?single chip or expanded ?16/16 wide or 16/8 narrow modes ?memory ?16-kbyte flash eeprom with 2-kbyte erase-protected boot block ?512-byte eeprom ?512-byte ram with single-cycle access for aligned or misaligned read/write ?8-channel, 10-bit analog-to-digital converter ?7-channel timer ?each channel fully configurable as either input capture or output compare ?simple pwm mode ?modulo reset of timer counter ?16-bit pulse accumulator ?external event counting ?gated time accumulation ?pulse-width modulator ?8-bit, 4-channel or 16-bit, 2-channel ?separate control for each pulse width and duty cycle ?programmable center-aligned or left-aligned outputs ?serial interfaces f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 2 MC68HC912BL16TS/d ?asynchronous serial communications interface (sci) ?synchronous serial peripheral interface (spi) ?cop watchdog timer, clock monitor, and periodic interrupt timer ?64-pin qfp package ?up to 49 general-purpose i/o lines ?4.5v?.5v operation at 8 mhz ?single-wire background debug mode (bdm) ?on-chip hardware breakpoints 1.2 ordering information the mc68hc912bl16 is packaged in 64-pin quad flat pack (qfp) packaging and is shipped in two- piece sample packs, 50-piece trays, or 250-piece bricks. operating temperature range and voltage re- quirements are specified when ordering the mc68hc912bl16 device. refer to table 1 for part num- bers. note: this part is also available in 2-piece sample packs and 250-piece bricks. evaluation boards, assemblers, compilers, and debuggers are available from motorola and from third- party suppliers. an up-to-date list of products that support the m68hc12 family of microcontrollers can be found on the world wide web at the following url: http://www.mcu.motsps.com documents to assist in product selection are available from the motorola literature distribution center or your local motorola sales office: amcu device selection guide (sg166/d) amcu software and development tool selector guide (sg176/d) table 1 mc68hc912bl16 device ordering information order number temperature voltage frequency package range designator mc68hc912bl16fu8 0 to + 70 ? 4.5v?.5v 8 mhz 64-pin qfp single tray 50 pcs mc68hc912bl16cfu8 - 40 to + 85 ? c mc68hc912bl16vfu8 - 40 to + 105 ? v mc68hc912bl16mfu8 - 40 to + 125 ? m f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
section page table of contents mc68hc912bl16 motorola MC68HC912BL16TS/d 3 1 introduction 1 1.1 features ......................................................................................................................................1 1.2 ordering information ...................................................................................................................2 1.3 mc68hc912bl16 block diagram ...............................................................................................5 2 central processing unit 6 2.1 programming model ....................................................................................................................6 2.2 data types ..................................................................................................................................7 2.3 addressing modes .......................................................................................................................7 2.4 indexed addressing modes .........................................................................................................8 2.5 opcodes and operands ..............................................................................................................8 3 pinout and signal descriptions 9 3.1 mc68hc912bl16 pin assignments ...........................................................................................9 3.2 power supply pins ....................................................................................................................10 3.3 signal descriptions ....................................................................................................................11 3.4 port signals ...............................................................................................................................15 3.5 port pull-up, pull-down and reduced drive .............................................................................19 4 register block 20 5 operating modes and resource mapping 25 5.1 operating modes .......................................................................................................................25 5.2 background debug mode ..........................................................................................................26 5.3 internal resource mapping .......................................................................................................28 5.4 memory maps ............................................................................................................................31 6 bus control and input/output 32 6.1 detecting access type from external signals ..........................................................................32 6.2 registers ...................................................................................................................................32 7 flash eeprom 37 7.1 overview ...................................................................................................................................37 7.2 flash eeprom control block ...................................................................................................37 7.3 flash eeprom array ...............................................................................................................37 7.4 flash eeprom registers .........................................................................................................37 7.5 operation ...................................................................................................................................40 7.6 programming the flash eeprom ............................................................................................42 7.7 erasing the flash eeprom ......................................................................................................44 7.8 program/erase protection interlocks .........................................................................................46 7.9 stop or wait mode .....................................................................................................................46 7.10 test mode .................................................................................................................................46 7.11 flash program/erase voltage signal conditioning ................................................................46 8 eeprom 49 8.1 eeprom programmer? model ................................................................................................49 8.2 eeprom control registers ......................................................................................................50 9 resets and interrupts 54 9.1 exception priority ......................................................................................................................54 9.2 maskable interrupts ...................................................................................................................54 9.3 interrupt control and priority registers .....................................................................................55 9.4 resets .......................................................................................................................................56 9.5 effects of reset .........................................................................................................................56 9.6 register stacking ......................................................................................................................57 10 clock functions 59 10.1 clock sources ...........................................................................................................................59 10.2 computer operating properly (cop) ........................................................................................59 10.3 real-time interrupt ...................................................................................................................59 10.4 clock monitor ............................................................................................................................59 10.5 clock function registers ..........................................................................................................60 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
section page table of contents (continued) motorola mc68hc912bl16 4 MC68HC912BL16TS/d 10.6 clock divider chains .................................................................................................................63 11 pulse-width modulator 67 11.1 pwm register description ........................................................................................................69 11.2 pwm boundary cases ..............................................................................................................76 12 standard timer module 77 12.1 timer registers .........................................................................................................................78 12.2 timer operation in modes .........................................................................................................86 13 serial interface 87 13.1 block diagram ...........................................................................................................................87 13.2 serial communication interface (sci) .......................................................................................87 13.3 serial peripheral interface (spi) ................................................................................................94 13.4 port s ......................................................................................................................................100 14 analog-to-digital converter 104 14.1 functional description .............................................................................................................104 14.2 atd registers .........................................................................................................................104 14.3 atd mode operation ..............................................................................................................111 15 development support 113 15.1 instruction queue ....................................................................................................................113 15.2 background debug mode ........................................................................................................113 15.3 breakpoints .............................................................................................................................122 15.4 instruction tagging ..................................................................................................................126 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 5 1.3 mc68hc912bl16 block diagram figure 1 mc68hc912bl16 block diagram ioc0 ioc1 ioc2 ioc3 ioc4 ioc5 ioc6 pai oc7 periodic interrupt cop watchdog 16-kbyte flash eeprom 512-byte ram timer and pt0 pt1 pt2 pt3 pt4 pt5 pt7 spi atd pe1 pe2 pe4 pe5 pe6 pe3 pad3 pad4 pad5 pad6 pad7 v dda v ssa v rh v rl pad0 pad1 pad2 ddra port a ddrb port b multiplexed address/data bus reset extal xtal pw0 pw1 pw2 pw3 pwm pp0 pp1 pp2 pp3 v dd 1 v ss 1 sci rxd txd sdi/miso sdo/mosi sck cs /ss ps0 ps1 ps4 ps5 ps6 ps7 512-byte eeprom clock monitor pe0 pe7 an3 an4 an5 an6 an7 v dda v ssa v rh v rl an0 an1 an2 single-wire background debug module smodn / t a ghi eclk r/w lstrb / taglo ipipe0 / moda ipipe1 / modb xirq dbe pulse accumulator lite irq integration module (lim) v fp break points cpu12 converter v ssx 2 v ddx 2 power for power for i/o drivers internal circuitry narrow bus wide bus bkgd f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 6 MC68HC912BL16TS/d 2 central processing unit the cpu12 is a high-speed, 16-bit processing unit. it has full 16-bit data paths and wider internal reg- isters (up to 20 bits) for high-speed extended math instructions. the instruction set is a proper superset of the m68hc11instruction set. the cpu12 allows instructions with odd byte counts, including many single-byte instructions. this provides efficient use of rom space. an instruction queue buffers pro- gram information so the cpu always has immediate access to at least three bytes of machine code at the start of every instruction. the cpu12 also offers an extensive set of indexed addressing capabilities. 2.1 programming model cpu12 registers are an integral part of the cpu and are not addressed as if they were memory loca- tions. figure 2 programming model accumulators a and b are general-purpose 8-bit accumulators used to hold operands and results of arithmetic calculations or data manipulations. some instructions treat the combination of these two 8- bit accumulators as a 16-bit double accumulator (accumulator d). index registers x and y are used for indexed addressing mode. in the indexed addressing mode, the contents of a 16-bit index register are added to 5-bit, 9-bit, or 16-bit constants or the content of an ac- cumulator to form the effective address of the operand to be used in the instruction. stack pointer (sp) points to the last stack location used. the cpu12 supports an automatic program stack that is used to save system context during subroutine calls and interrupts, and can also be used for temporary storage of data. the stack pointer can also be used in all indexed addressing modes. program counter is a 16-bit register that holds the address of the next instruction to be executed. the program counter can be used in all indexed addressing modes except auto-increment/decrement. condition code register (ccr) contains five status indicators, two interrupt masking bits, and a stop disable bit. the five flags are half carry (h), negative (n), zero (z), overflow (v), and carry/borrow (c). the half-carry flag is used only for bcd arithmetic operations. the n, z, v, and c status bits allow for branching based on the results of a previous operation. 7 15 15 15 15 15 d ix iy sp pc a b n s x h i z v c 0 0 0 0 0 0 7 0 condition code register 8-bit accumula tors a & b 16-bit double a ccumula tor d index register x index register y stack pointer program counter or hc12 prog model f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 7 2.2 data types the cpu12 supports the following data types: ?bit data ?8-bit and 16-bit signed and unsigned integers ?16-bit unsigned fractions ?16-bit addresses a byte is eight bits wide and can be accessed at any byte location. a word is composed of two consec- utive bytes with the most significant byte at the lower value address. there are no special requirements for alignment of instructions or operands. 2.3 addressing modes addressing modes determine how the cpu accesses memory locations to be operated upon. the cpu12 includes all of the addressing modes of the m68hc11 cpu as well as several new forms of in- dexed addressing. table 2 is a summary of the available addressing modes. table 2 m68hc12 addressing mode summary addressing mode source format abbreviation description inherent inst (no externally supplied operands) inh operands (if any) are in cpu registers immediate inst # opr8i or inst # opr16i imm operand is included in instruction stream 8- or 16-bit size implied by context direct inst opr8a dir operand is the lower 8-bits of an address in the range $0000 ?$00ff extended inst opr16a ext operand is a 16-bit address relative inst rel8 or inst rel16 rel an 8-bit or 16-bit relative offset from the current pc is supplied in the instruction indexed (5-bit offset) inst oprx5 , xysp idx 5-bit signed constant offset from x, y, sp, or pc indexed (auto pre-decrement) inst oprx3 , xys idx auto pre-decrement x, y, or sp by 1 ~ 8 indexed (auto pre-increment) inst oprx3 ,+ xys idx auto pre-increment x, y, or sp by 1 ~ 8 indexed (auto post- decrement) inst oprx3 , xys idx auto post-decrement x, y, or sp by 1 ~ 8 indexed (auto post-increment) inst oprx3 , xys + idx auto post-increment x, y, or sp by 1 ~ 8 indexed (accumulator offset) inst abd , xysp idx indexed with 8-bit (a or b) or 16-bit (d) accumu- lator offset from x, y, sp, or pc indexed (9-bit offset) inst oprx9 , xysp idx1 9-bit signed constant offset from x, y, sp, or pc (lower 8-bits of offset in one extension byte) indexed (16-bit offset) inst oprx16 , xysp idx2 16-bit constant offset from x, y, sp, or pc (16-bit offset in two extension bytes) indexed-indirect (16-bit offset) inst [ oprx16 , xysp ] [idx2] pointer to operand is found at... 16-bit constant offset from x, y, sp, or pc (16-bit offset in two extension bytes) indexed-indirect (d accumulator offset) inst [d, xysp ] [d,idx] pointer to operand is found at... x, y, sp, or pc plus the value in d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 8 MC68HC912BL16TS/d 2.4 indexed addressing modes the cpu12 indexed modes reduce execution time and eliminate code size penalties for using the y index register. cpu12 indexed addressing uses a postbyte plus zero, one, or two extension bytes after the instruction opcode. the postbyte and extensions do the following tasks: ?specify which index register is used ?determine whether a value in an accumulator is used as an offset ?enable automatic pre- or post-increment or decrement ?specify use of 5-bit, 9-bit, or 16-bit signed offsets 2.5 opcodes and operands the cpu12 uses 8-bit opcodes. each opcode identifies a particular instruction and associated address- ing mode to the cpu. several opcodes are required to provide each instruction with a range of address- ing capabilities. only 256 opcodes would be available if the range of values were restricted to the number that can be represented by 8-bit binary numbers. to expand the number of opcodes, a second page is added to the opcode map. opcodes on the second page are preceded by an additional byte with the value $18. to provide additional addressing flexibility, opcodes can also be followed by a postbyte or extension bytes. postbytes implement certain forms of indexed addressing, transfers, exchanges, and loop prim- itives. extension bytes contain additional program information such as addresses, offsets, and immedi- ate data. table 3 summary of indexed operations postbyte code (xb) source code syntax comments rr; 00 = x, 01 = y, 10 = sp, 11 = pc rr0nnnnn ,r n,r - n,r 5-bit constant offset n = ?6 to +15 r can specify x, y, sp, or pc 111rr0zs n,r - n,r constant offset (9- or 16-bit signed) z- 0 = 9-bit with sign in lsb of postbyte(s) -256 < n < 255 1 = 16-bit 0 < n < 65,535 if z = s = 1, 16-bit offset indexed-indirect (see below) r can specify x, y, sp, or pc 111rr011 [n,r] 16-bit offset indexed-indirect rr can specify x, y, sp, or pc 0 < n < 65,535 rr1pnnnn n, - r n, + r n,r - n,r + auto pre-decrement/increment or auto post-decrement/increment ; p = pre-(0) or post-(1), n = ? to ?, +1 to +8 r can specify x, y, or sp (pc not a valid choice) +8 = 0111 +1 = 0000 -1 = 1111 -8 = 1000 111rr1aa a,r b,r d,r accumulator offset (unsigned 8-bit or 16-bit) aa- 00 = a 01 = b 10 = d (16-bit) 11 = see accumulator d offset indexed-indirect r can specify x, y, sp, or pc 111rr111 [d,r] accumulator d offset indexed-indirect r can specify x, y, sp, or pc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 9 3 pinout and signal descriptions 3.1 mc68hc912bl16 pin assignments the mc68hc912bl16 is available in a 64-pin quad flat pack (qfp). most pins perform two or more functions, as described in the 3.3 signal descriptions . figure 3 shows pin assignments. shaded pins are power and ground. figure 3 pin assignments for mc68hc912bl16 mc68hc912bl16 64-pin qfp hc12 64qfp * in narrow mode, high and low data bytes are multiplexed in alternate bus cycles on port a. smodn / t a ghi / bkgd v rl pai / ioc7 / pt7 ioc5 / pt5 ioc4 / pt4 ioc3 / pt3 ioc2 / pt2 ioc1 / pt1 ioc0 / pt0 addr0 / data0 / pb0 addr1 / data1 / pb1 addr2 / data2 / pb2 addr3 / data3 / pb3 addr4 / data4 / pb4 addr5 / data5 / pb5 addr6 / data6 / pb6 addr7 / data7 / pb7 pad6 / an6 pad5 / an5 pad4 / an4 pad3 / an3 pad2 / an2 pad1 / an1 pad0 / an0 v rh v ss v dd pa7 / data15 / addr15 pa6 / data14 / addr14 pa5 / data13 / addr13 pa4 / data12 / addr12 pa3 / data11 / addr11 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 10 MC68HC912BL16TS/d 3.2 power supply pins mc68hc912bl16 power and ground pins are described below and summarized in table 4 . 3.2.1 internal power (v dd ) and ground (v ss ) power is supplied to the mcu through v dd and v ss . because fast signal transitions place high, short- duration current demands on the power supply, use bypass capacitors with high-frequency character- istics and place them as close to the mcu as possible. bypass requirements depend on how heavily the mcu pins are loaded. 3.2.2 external power (v ddx ) and ground (v ssx ) external power and ground for i/o drivers. because fast signal transitions place high, short-duration cur- rent demands on the power supply, use bypass capacitors with high-frequency characteristics and place them as close to the mcu as possible. bypass requirements depend on how heavily the mcu pins are loaded. 3.2.3 v dda , v ssa provides operating voltage and ground for the analog-to-digital converter. this allows the supply volt- age to the a/d to be bypassed independently. 3.2.4 analog-to-digital reference voltages (v rh , v rl ) 3.2.5 v fp flash eeprom programming voltage and supply voltage during normal operation. 3.3 signal descriptions 3.3.1 crystal driver and external clock input (xtal, extal) these pins provide the interface for either a crystal or a cmos compatible clock to control the internal clock generator circuitry. out of reset the frequency applied to extal is twice the desired e-clock rate. all the device clocks are derived from the extal input frequency. table 4 mc68hc912bl16 power and ground connection summary mnemonic pin number description v dd 38 internal power and ground. v ss 39 v ddx 22, 60 external power and ground, supply to pin drivers. v ssx 21, 59 v dda 50 operating voltage and ground for the analog-to-digital converter, allows the supply voltage to the a/d to be bypassed independently. v ssa 51 v rh 40 reference voltages for the analog-to-digital converter. v rl 41 v fp 58 programming voltage for the flash eeprom and required supply for normal operation. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 11 figure 4 common crystal connections figure 5 external oscillator connections xtal is the crystal output. the xtal pin must be left unterminated when an external cmos compatible clock input is connected to the extal pin. the xtal output is normally intended to drive only a crystal. the xtal output can be buffered with a high-impedance buffer to drive the extal input of another de- vice. in all cases take extra care in the circuit board layout around the oscillator pins. load capacitances shown in the oscillator circuits include all stray layout capacitances. refer to figure 4 and figure 5 for diagrams of oscillator circuits. 3.3.2 e-clock output (eclk) eclk is the output connection for the internal bus clock and is used to demultiplex the address and data and is used as a timing reference. eclk frequency is equal to 1/2 the crystal frequency out of reset. in normal single-chip mode the e-clock output is off at reset to reduce the effects of rfi but can be turned on if necessary. in special single-chip mode the e-clock output is on at reset but can be turned off. in special peripheral mode the e clock is an input to the mcu. all clocks, including the e-clock, are halted when the mcu is in stop mode. it is possible to configure the mcu to interface to slow external memory. eclk can be stretched for such accesses. 10 m w mcu c c extal xtal 2 x e crystal common xtal conn nc mcu extal xtal 2 x e cmos-compatible ext extal conn external oscillator f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 12 MC68HC912BL16TS/d 3.3.3 reset (reset ) an active low bidirectional control signal, reset , acts as an input to initialize the mcu to a known start- up state. it also acts as an open-drain output to indicate that an internal failure has been detected in either the clock monitor or cop watchdog circuit. the mcu goes into reset asynchronously and comes out of reset synchronously. this allows the part to reach a proper reset state even if the clocks have failed, while allowing synchronized operation when starting out of reset. it is possible to determine whether a reset was caused by an internal source or an external source. an internal source drives the pin low for 16 cycles; eight cycles later the pin is sampled. if the pin has re- turned high, either the cop watchdog vector or clock monitor vector will be taken. if the pin is still low, the external reset is determined to be active and the reset vector is taken. hold reset low for at least 32 cycles to assure that the reset vector is taken in the event that an internal cop watchdog time-out or clock monitor fail occurs. 3.3.4 maskable interrupt request (irq ) the irq input provides a means of applying asynchronous interrupt requests to the mcu. either falling edge-sensitive triggering or level-sensitive triggering is program selectable (intcr register). irq is al- ways configured to level-sensitive triggering at reset. when the mcu is reset the irq function is masked in the condition code register. 3.3.5 nonmaskable interrupt (xirq ) the xirq input provides a means of requesting a nonmaskable interrupt after reset initialization. during reset, the x bit in the condition code register (ccr) is set and any interrupt is masked until mcu soft- ware enables it. because the xirq input is level sensitive, it can be connected to a multiple-source wired-or network. this pin is always an input and can always be read. there is an active pull-up on this pin while in reset and immediately out of reset. the pull-up can be turned off by clearing pupe in the pucr register. xirq is often used as a power loss detect interrupt. whenever xirq or irq are used with multiple interrupt sources (irq must be configured for level-sen- sitive operation if there is more than one source of irq interrupt), each source must drive the interrupt input with an open-drain type of driver to avoid contention between outputs. there must also be an in- terlock mechanism at each interrupt source so that the source holds the interrupt line low until the mcu recognizes and acknowledges the interrupt request. if the interrupt line is held low, the mcu will recog- nize another interrupt as soon as the interrupt mask bit in the mcu is cleared (normally upon return from an interrupt). 3.3.6 mode select (smodn, moda, and modb) the state of these pins during reset determine the mcu operating mode. after reset, moda and modb can be configured as instruction queue tracking signals ipipe0 and ipipe1. moda and modb have active pulldowns during reset. the smodn pin can be used as bkgd or t a ghi after reset. 3.3.7 single-wire background mode pin (bkgd) the bkgd pin receives and transmits serial background debugging commands. a special self-timing protocol is used. the bkgd pin has an active pull-up when configured as input; bkgd has no pull-up control. refer to 16 development support . 3.3.8 external address and data buses (addr[15:0] and data[15:0]) external bus pins share function with general-purpose i/o ports a and b. in single-chip operating modes, the pins can be used for i/o; in expanded modes, the pins are used for the external buses. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 13 in expanded wide mode, ports a and b are used for multiplexed 16-bit data and address buses. pa[7:0] correspond to addr[15:8]/data[15:8]; pb[7:0] correspond to addr[7:0]/data[7:0]. in expanded narrow mode, ports a and b are used for the 16-bit address bus, and an 8-bit data bus is multiplexed with the most significant half of the address bus on port a. in this mode, 16-bit data is han- dled as two back-to-back bus cycles, one for the high byte followed by one for the low byte. pa[7:0] correspond to addr[15:8] and to data[15:8] or data[7:0], depending on the bus cycle. the state of the address pin should be latched at the rising edge of e. to allow for maximum address setup time at external devices, a transparent latch should be used. 3.3.9 read/write (r/w ) in all modes this pin can be used as i/o and is a general-purpose input with an active pull-up out of reset. if the read/write function is required it should be enabled by setting the rdwe bit in the pear register. external writes will not be possible until enabled. 3.3.10 low-byte strobe (lstrb ) in all modes this pin can be used as i/o and is a general-purpose input with an active pull-up out of reset. if the strobe function is required, it should be enabled by setting the lstre bit in the pear reg- ister. this signal is used in write operations and so external low byte writes will not be possible until this function is enabled. this pin is also used as t a glo in special expanded modes and is multiplexed with the lstrb function. 3.3.11 instruction queue tracking signals (ipipe1 and ipipe0) these signals are used to track the state of the internal instruction execution queue. execution state is time-multiplexed on the two signals. refer to 16 development support . 3.3.12 data bus enable (dbe ) the dbe pin (pe7) is an active low signal that will be asserted low during e-clock high time. dbe pro- vides separation between output of a multiplexed address and the input of data. when an external ad- dress is stretched, dbe is asserted during what would be the last quarter cycle of the last e-clock cycle of stretch. in expanded modes this pin is used to enable the drive control of external buses during ex- ternal reads only. use of the dbe is controlled by the ndbe bit in the pear register. dbe is enabled out of reset in expanded modes. this pin has an active pull-up during and after reset in single-chip modes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 14 MC68HC912BL16TS/d table 5 mc68hc912bl16 signal description summary pin name pin number description pw[3:0] 61?4 pulse width modulator channel outputs. addr[7:0] data[7:0] 16? external bus pins share function with general-purpose i/o ports a and b. in sin- gle chip modes, the pins can be used for i/o. in expanded modes, the pins are used for the external buses. addr[15:8] data[15:8] 37?0 ioc[7], ioc[5:0] 7? pins used for input capture and output compare in the timer and pulse accumu- lator subsystem. pai 7 pulse accumulator input an[7:0] 49?2 analog inputs for the analog-to-digital conversion module dbe 17 data bus control and, in expanded mode, enables the drive control of external buses during external reads. modb, moda 18, 19 state of mode select pins during reset determine the initial operating mode of the mcu. after reset, modb and moda can be configured as instruction queue tracking signals ipipe1 and ipipe0 or as general-purpose i/o pins. ipipe1, ipipe0 18, 19 eclk 20 e-clock is the output connection for the external bus clock. eclk is used as a timing reference and for address demultiplexing. reset 23 an active low bidirectional control signal, reset acts as an input to initialize the mcu to a known start-up state, and an output when cop or clock monitor causes a reset. extal 24 crystal driver and external clock input pins. on reset all the device clocks are de- rived from the extal input frequency. xtal is the crystal output. xtal 25 lstrb 26 low byte strobe (0 = low byte valid), in all modes this pin can be used as i/o. the low strobe function is the exclusive-nor of a0 and the internal sz8 signal. (the sz8 internal signal indicates the size 16/8 access.) t a glo 26 pin used in instruction tagging. see 16 development support . r/w 27 indicates direction of data on expansion bus. shares function with general-pur- pose i/o. read/write in expanded modes. irq 28 maskable interrupt request input provides a means of applying asynchronous in- terrupt requests to the mcu. either falling edge-sensitive triggering or level-sen- sitive triggering is program selectable (intcr register). xirq 29 provides a means of requesting asynchronous non-maskable interrupt requests after reset initialization. bkgd 8 single-wire background interface pin is dedicated to the background debug func- tion. during reset, this pin determines special or normal operating mode. t a ghi 8 pin used in instruction tagging. see 16 development support . cs /ss 57 slave select output for spi master mode, input for slave mode or master mode. sck 56 serial clock for spi system. sdo/mosi 55 master out/slave in pin for serial peripheral interface sdi/miso 54 master in/slave out pin for serial peripheral interface txd 53 sci transmit pin rxd 52 sci receive pin f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 15 3.4 port signals the mc68hc912bl16 incorporates eight ports which are used to control and access the various device subsystems. when not used for these purposes, port pins may be used for general-purpose i/o. in ad- dition to the pins described below, each port consists of a data register which can be read and written at any time, and, with the exception of port ad and pe[1:0], a data direction register which controls the direction of each pin. after reset all port pins are configured as input. 3.4.1 port a port a pins are used for address and data in expanded modes. the port data register is not in the ad- dress map during expanded and peripheral mode operation. when it is in the map, port a can be read or written at anytime. register ddra determines whether each port a pin is an input or output. ddra is not in the address map during expanded and peripheral mode operation. setting a bit in ddra makes the corresponding bit in port a an output; clearing a bit in ddra makes the corresponding bit in port a an input. the default reset state of ddra is all zeros. when the pupa bit in the pucr register is set, all port a input pins are pulled up internally by an active pull-up device. this bit has no effect if the port is being used in expanded modes as the pull-ups are inactive. setting the rdpa bit in register rdriv causes all port a outputs to have reduced drive level. rdriv can be written once after reset. rdriv is not in the address map in peripheral mode. refer to 6 bus control and input/output . 3.4.2 port b port b pins are used for address and data in expanded modes. the port data register is not in the ad- dress map during expanded and peripheral mode operation. when it is in the map, port b can be read or written at anytime. register ddrb determines whether each port b pin is an input or output. ddrb is not in the address map during expanded and peripheral mode operation. setting a bit in ddrb makes the corresponding bit in port b an output; clearing a bit in ddrb makes the corresponding bit in port b an input. the default reset state of ddrb is all zeros. when the pupb bit in the pucr register is set, all port b input pins are pulled up internally by an active pull-up device. this bit has no effect if the port is being used in expanded modes as the pull-ups are inactive. setting the rdpb bit in register rdriv causes all port b outputs to have reduced drive level. rdriv can be written once after reset. rdriv is not in the address map in peripheral mode. refer to 6 bus control and input/output . 3.4.3 port e port e pins operate differently from port a and b pins. port e pins are used for bus control signals and interrupt service request signals. when a pin is not used for one of these specific functions, it can be used as general-purpose i/o. however, two of the pins (pe[1:0]) can only be used for input, and the states of these pins can be read in the port data register even when they are used for irq and xirq . the pear register determines pin function, and register ddre determines whether each pin is an input or output when it is used for general-purpose i/o. pear settings override ddre settings. because pe[1:0] are input-only pins, only ddre[7:2] have effect. setting a bit in the ddre register makes the corresponding bit in port e an output; clearing a bit in the ddre register makes the corresponding bit in port e an input. the default reset state of ddre is all zeros. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 16 MC68HC912BL16TS/d when the pupe bit in the pucr register is set, pe[7,3,2, 1, 0] are pulled up. pe[7,3,2, 1, 0] are pulled up active devices. neither port e nor ddre is in the map in peripheral mode; neither is in the internal map in expanded modes with eme set. setting the rdpe bit in register rdriv causes all port e outputs to have reduced drive level. rdriv can be written once after reset. rdriv is not in the address map in peripheral mode. refer to 6 bus control and input/output . 3.4.4 port ad input to the analog-to-digital subsystem and general-purpose input. when analog-to-digital functions are not enabled, the port has eight general-purpose input pins, pad[7:0]. the adpu bit in the atdctl2 register enables the a/d function. port ad pins are inputs; no data direction register is associated with this port. the port has no resistive input loads and no reduced drive controls. refer to 15 analog-to-digital converter . 3.4.5 port p the four pulse-width modulation channel outputs share general-purpose port p pins. the pwm function is enabled with the pwen register. enabling pwm pins takes precedence over the general-purpose port. when pulse-width modulation is not in use, the port pins may be used for general-purpose i/o. register ddrp determines pin direction of port p when used for general-purpose i/o. when ddrp bits are set, the corresponding pin is configured for output. on reset the ddrp bits are cleared and the cor- responding pin is configured for input. when the pupp bit in the pwctl register is set, all input pins are pulled up internally by an active pull- up device. pull-ups are disabled after reset. setting the rdpp bit in the pwctl register configures all port p outputs to have reduced drive levels. levels are at normal drive capability after reset. the pwctl register can be read or written anytime after reset. refer to 11 pulse-width modulator . 3.4.6 port t this port provides seven general-purpose i/o pins when not enabled for input capture and output com- pare in the timer and pulse accumulator subsystem. the ten bit in the tscr register enables the timer function. the pulse accumulator subsystem is enabled with the paen bit in the pactl register. register ddrt determines pin direction of port t when used for general-purpose i/o. when ddrt bits are set, the corresponding pin is configured for output. on reset the ddrt bits are cleared and the cor- responding pin is configured for input. when the pupt bit in the tmsk2 register is set, all input pins are pulled up internally by an active pull- up device. pull-ups are disabled after reset. setting the rdpt bit in the tmsk2 register configures all port t outputs to have reduced drive levels. levels are at normal drive capability after reset. the tmsk2 register can be read or written anytime after reset. refer to 12 standard timer module . 3.4.7 port s port s is the 6-bit interface to the standard serial interface consisting of the serial communications in- terface (sci) and serial peripheral interface (spi) subsystems. port s pins are available for general-pur- pose parallel i/o when standard serial functions are not enabled. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 17 port s pins serve several functions depending on the various internal control registers. if woms bit in the sc0cr1 register is set, the p-channel drivers of the output buffers are disabled for bits 0 through 1 (2 through 3). if swom bit in the sp0cr1 register is set, the p-channel drivers of the output buffers are disabled for bits 4 through 7. (wired-or mode). the open drain control effects both the serial and the general-purpose outputs. if the rdpsx bits in the purds register are set, the appropriate port s pin drive capabilities are reduced. if pupsx bits in the purds register are set, the appropriate pull-up de- vice is connected to each port s pin which is programmed as a general-purpose input . if the pin is pro- grammed as a general-purpose output, the pull-up is disconnected from the pin regardless of the state of the individual pupsx bits. see 13 serial interface . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 18 MC68HC912BL16TS/d table 6 mc68hc912bl16 port description summary port name pin numbers data direction dd register (address) description port a pa[7:0] 37?0 in/out ddra ($0002) port a and port b pins are used for address and data in ex- panded modes. the port data registers are not in the address map during expanded and peripheral mode operation. when in the map, port a and port b can be read or written any time. ddra and ddrb are not in the address map in expanded or peripheral modes. port b pb[7:0] 16? in/out ddrb ($0003) port ad pad[7:0] 49?2 in analog-to-digital converter and general-purpose i/o. port e pe[7:0] 20?7, 29?6 pe[1:0] in pe[7:2] in/out ddre ($0009) mode selection , bus control signals and interrupt service request signals; or general-purpose i/o. port p pp[3:0] 61?4 in/out ddrp ($0057) pp[3:0] are use with the pulse-width modulator when en- abled. port s ps[7:4] ps[1:0] 57?4, 53-52 in/out ddrs ($00d7) serial communications interface and serial peripheral in- terface subsystems and general-purpose i/o. port t pt[7] pt[5:0] 7, 6? in/out ddrt ($00af) general-purpose i/o when not enabled for input capture and output compare in the timer and pulse accumulator sub- system. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 19 3.5 port pull-up, pull-down and reduced drive mcu ports can be configured for internal pull-up. to reduce power consumption and rfi, the pin output drivers can be configured to operate at a reduced drive level. reduced drive causes a slight increase in transition time depending on loading and should be used only for ports which have a light loading. table 7 summarizes the port pull-up default status and controls. table 7 port pull-up, pull-down and reduced drive summary enable bit reduced drive control bit port name resistive input loads register (address) bit name reset state register (address) bit name reset state port a pull-up pucr ($000c) pupa disabled rdriv ($000d) rdpa full drive port b pull-up pucr ($000c) pupb disabled rdriv ($000d) rdpb full drive port e: pe7, pe3, pe2, pe1, pe0 pull-up pucr ($000c) pupe enabled rdriv ($000d) rdpe full drive pe[6:4] none rdriv ($000d) rdpe full drive pe[6:5] pull-down enabled during reset port p pull-up pwctl ($0054) pupp disabled pwctl ($0054) rdpp full drive port s pull-up purds ($00db) pups0 disabled purds ($00db) rdps0 full drive ps[7:4] pull-up purds ($00db) pups2 disabled purds ($00db) rdps2 full drive port t pull-up tmsk2 ($008d) pupt disabled tmsk2 ($008d) rdpt full drive port ad none bkgd pull-up enabled full drive f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 20 MC68HC912BL16TS/d 4 register block the register block can be mapped to any 2-kbyte boundary within the standard 64-kbyte address space by manipulating bits reg[15:11] in the initrg register. initrg establishes the upper five bits of the register block? 16-bit address. the register block occupies the first 512 bytes of the 2-kbyte block. de- fault addressing (after reset) is indicated in the table below. for additional information refer to 5 oper- ating modes and resource mapping . table 8 mc68hc912bl16 register map (sheet 1 of 5) address bit 7 6 5 4 3 2 1 bit 0 name $0000 pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 porta 1 $0001 pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 portb 1 $0002 dda7 dda6 dda5 dda4 dda3 dda2 dda1 dda0 ddra 1 $0003 ddb7 ddb6 ddb5 ddb4 ddb3 ddb2 ddb1 ddb0 ddrb 1 $0004 0 0 0 0 0 0 0 0 reserved $0005 0 0 0 0 0 0 0 0 reserved $0006 0 0 0 0 0 0 0 0 reserved $0007 0 0 0 0 0 0 0 0 reserved $0008 pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 porte 2 $0009 dde7 dde6 dde5 dde4 dde3 dde2 0 0 ddre 2 $000a ndbe 0 pipoe neclk lstre rdwe 0 0 pear 2 $000b smodn modb moda estr ivis ebswai 0 eme mode 3 $000c 0 0 0 pupe 0 0 pupb pupa pucr 3 $000d 0 0 0 0 rdpe 0 rdpb rdpa rdriv 3 $000e 0 0 0 0 0 0 0 0 reserved $000f 0 0 0 0 0 0 0 0 reserved $0010 ram15 ram14 ram13 ram12 ram11 0 0 0 initrm $0011 reg15 reg14 reg13 reg12 reg11 0 0 mmswai initrg $0012 ee15 ee14 ee13 ee12 0 0 0 eeon initee $0013 0 ndrf rfstr1 rfstr0 exstr1 exstr0 maprom romon misc $0014 rtie rswai rsbck 0 rtbyp rtr2 rtr1 rtr0 rtictl $0015 rtif 0 0 0 0 0 0 0 rtiflg $0016 cme fcme fcm fcop disr cr2 cr1 cr0 copctl $0017 bit 7 6 5 4 3 2 1 bit 0 coprst $0018 ite6 ite8 itea itec itee itf0 itf2 itf4 itst0 $0019 itd6 itd8 itda itdc itde ite0 ite2 ite4 itst1 $001a itc6 itc8 itca itcc itce itd0 itd2 itd4 itst2 $001b 0 0 0 0 0 itc0 itc2 itc4 itst3 $001c $001d 0 0 0 0 0 0 0 0 reserved $001e irqe irqen dly 0 0 0 0 0 intcr $001f 1 1 psel5 psel4 psel3 psel2 psel1 0 hprio $0020 bken1 bken0 bkpm 0 bk1ale bk0ale 0 0 brkct0 $0021 0 bkdbe bkmbh bkmbl bk1rwe bk1rw bk0rwe bk0rw brkct1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 21 $0022 bit 15 14 13 12 11 10 9 bit 8 brkah $0023 bit 7 6 5 4 3 2 1 bit 0 brkal $0024 bit 15 14 13 12 11 10 9 bit 8 brkdh $0025 bit 7 6 5 4 3 2 1 bit 0 brkdl $0026 $003f 0 0 0 0 0 0 0 0 reserved $0040 con23 con01 pcka2 pcka1 pcka0 pckb2 pckb1 pckb0 pwclk $0041 pclk3 pclk2 pclk1 pclk0 ppol3 ppol2 ppol1 ppol0 pwpol $0042 0 0 0 0 pwen3 pwen2 pwen1 pwen0 pwen $0043 0 6 5 4 3 2 1 bit 0 pwpres $0044 bit 7 6 5 4 3 2 1 bit 0 pwscal0 $0045 bit 7 6 5 4 3 2 1 bit 0 pwscnt0 $0046 bit 7 6 5 4 3 2 1 bit 0 pwscal1 $0047 bit 7 6 5 4 3 2 1 bit 0 pwscnt1 $0048 bit 7 6 5 4 3 2 1 bit 0 pwcnt0 $0049 bit 7 6 5 4 3 2 1 bit 0 pwcnt1 $004a bit 7 6 5 4 3 2 1 bit 0 pwcnt2 $004b bit 7 6 5 4 3 2 1 bit 0 pwcnt3 $004c bit 7 6 5 4 3 2 1 bit 0 pwper0 $004d bit 7 6 5 4 3 2 1 bit 0 pwper1 $004e bit 7 6 5 4 3 2 1 bit 0 pwper2 $004f bit 7 6 5 4 3 2 1 bit 0 pwper3 $0050 bit 7 6 5 4 3 2 1 bit 0 pwdty0 $0051 bit 7 6 5 4 3 2 1 bit 0 pwdty1 $0052 bit 7 6 5 4 3 2 1 bit 0 pwdty2 $0053 bit 7 6 5 4 3 2 1 bit 0 pwdty3 $0054 0 0 0 pswai centr rdp pupp psbck pwctl $0055 discr discp discal 0 0 0 0 0 pwtst $0056 pp7 pp6 pp5 pp4 pp3 pp2 pp1 pp0 portpp $0057 ddp7 ddp6 ddp5 ddp4 ddp3 ddp2 ddp1 ddp0 portpd $0058 $005f 0 0 0 0 0 0 0 0 reserved $0060 0 0 0 0 0 0 0 0 atdctl0 $0061 0 0 0 0 0 0 0 0 atdctl1 $0062 adpu affc awai 0 0 0 ascie ascif atdctl2 $0063 0 0 0 0 0 0 frz1 frz0 atdctl3 $0064 s10bm smp1 smp0 prs4 prs3 prs2 prs1 prs0 atdctl4 $0065 0 s8cm scan mult cd cc cb ca atdctl5 $0066 scf 0 0 0 0 cc2 cc1 cc0 atdstat $0067 ccf7 ccf6 ccf5 ccf4 ccf3 ccf2 ccf1 ccf0 atdstat $0068 sar9 sar8 sar7 sar6 sar5 sar4 sar3 sar2 atdtsth $0069 sar1 sar0 rst tstout tst3 tst2 tst1 tst0 atdtstl table 8 mc68hc912bl16 register map (sheet 2 of 5) address bit 7 6 5 4 3 2 1 bit 0 name f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 22 MC68HC912BL16TS/d $006a $006e 0 0 0 0 0 0 0 0 reserved $006f pad7 pad6 pad5 pad4 pad3 pad2 pad1 pad0 portad $0070 bit 15 14 13 12 11 10 9 bit 8 adr0h $0071 bit 7 6 5 4 3 2 1 bit 0 adr0l $0072 bit 15 14 13 12 11 10 9 bit 8 adr1h $0073 bit 7 6 5 4 3 2 1 bit 0 adr1l $0074 bit 15 14 13 12 11 10 9 bit 8 adr2h $0075 bit 7 6 5 4 3 2 1 bit 0 adr2l $0076 bit 15 14 13 12 11 10 9 bit 8 adr3h $0077 bit 7 6 5 4 3 2 1 bit 0 adr3l $0078 bit 15 14 13 12 11 10 9 bit 8 adr4h $0079 bit 7 6 5 4 3 2 1 bit 0 adr4l $007a bit 15 14 13 12 11 10 9 bit 8 adr5h $007b bit 7 6 5 4 3 2 1 bit 0 adr5l $007c bit 15 14 13 12 11 10 9 bit 8 adr6h $007d bit 7 6 5 4 3 2 1 bit 0 adr6l $007e bit 15 14 13 12 11 10 9 bit 8 adr7h $007f bit 7 6 5 4 3 2 1 bit 0 adr7l $0080 ios7 ios6 ios5 ios4 ios3 ios2 ios1 ios0 tios $0081 foc7 foc6 foc5 foc4 foc3 foc2 foc1 foc0 cforc $0082 oc7m7 oc7m6 oc7m5 oc7m4 oc7m3 oc7m2 oc7m1 oc7m0 oc7m $0083 oc7d7 oc7d6 oc7d5 oc7d4 oc7d3 oc7d2 oc7d1 oc7d0 oc7d $0084 bit 15 14 13 12 11 10 9 bit 8 tcnt (h) $0085 bit 7 6 5 4 3 2 1 bit 0 tcnt (l) $0086 ten tswai tsbck tffca 0 0 0 0 tscr $0087 0 0 0 0 0 0 0 0 tqcr $0088 om7 ol7 om6 ol6 om5 ol5 om4 ol4 tctl1 $0089 om3 ol3 om2 ol2 om1 ol1 om0 ol0 tctl2 $008a edg7b edg7a edg6b edg6a edg5b edg5a edg4b edg4a tctl3 $008b edg3b edg3a edg2b edg2a edg1b edg1a edg0b edg0a tctl4 $008c c7i c6i c5i c4i c3i c2i c1i c0i tmsk1 $008d toi 0 pupt rdpt tcre pr2 pr1 pr0 tmsk2 $008e c7f c6f c5f c4f c3f c2f c1f c0f tflg1 $008f tof 0 0 0 0 0 0 0 tflg2 $0090 bit 15 14 13 12 11 10 9 bit 8 tc0 (h) $0091 bit 7 6 5 4 3 2 1 bit 0 tc0 (l) $0092 bit 15 14 13 12 11 10 9 bit 8 tc1 (h) $0093 bit 7 6 5 4 3 2 1 bit 0 tc1 (l) $0094 bit 15 14 13 12 11 10 9 bit 8 tc2 (h) $0095 bit 7 6 5 4 3 2 1 bit 0 tc2 (l) $0096 bit 15 14 13 12 11 10 9 bit 8 tc3 (h) table 8 mc68hc912bl16 register map (sheet 3 of 5) address bit 7 6 5 4 3 2 1 bit 0 name f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 23 $0097 bit 7 6 5 4 3 2 1 bit 0 tc3 (l) $0098 bit 15 14 13 12 11 10 9 bit 8 tc4 (h) $0099 bit 7 6 5 4 3 2 1 bit 0 tc4 (l) $009a bit 15 14 13 12 11 10 9 bit 8 tc5 (h) $009b bit 7 6 5 4 3 2 1 bit 0 tc5 (l) $009c bit 15 14 13 12 11 10 9 bit 8 tc6 (h) $009d bit 7 6 5 4 3 2 1 bit 0 tc6 (l) $009e bit 15 14 13 12 11 10 9 bit 8 tc7 (h) $009f bit 7 6 5 4 3 2 1 bit 0 tc7 (l) $00a0 0 paen pamod pedge clk1 clk0 paovi pai pactl $00a1 0 0 0 0 0 0 paovf paif paflg $00a2 bit 15 14 13 12 11 10 9 bit 8 pacnt $00a3 bit 7 6 5 4 3 2 1 bit 0 pacnt $00a4 $00ac 0 0 0 0 0 0 0 0 reserved $00ad 0 0 0 0 0 0 tcbyp pcbyp timtst $00ae pt7 pt6 pt5 pt4 pt3 pt2 pt1 pt0 portt $00af ddt7 ddt6 ddt5 ddt4 ddt3 ddt2 ddt1 ddt0 ddrt $00b0 $00bf 0 0 0 0 0 0 0 0 reserved $00c0 btst bspl brld sbr12 sbr11 sbr10 sbr9 sbr8 sc0bdh $00c1 sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 sc0bdl $00c2 loops woms rsrc m wake ilt pe pt sc0cr1 $00c3 tie tcie rie ilie te re rwu sbk sc0cr2 $00c4 tdre tc rdrf idle or nf fe pf sc0sr1 $00c5 0 0 0 0 0 0 0 raf sc0sr2 $00c6 r8 t8 0 0 0 0 0 0 sc0drh $00c7 r7/t7 r6/t6 r5/t5 r4/t4 r3/t3 r2/t2 r1/t1 r0/t0 sc0drl $00c8 $00cf 0 0 0 0 0 0 0 0 reserved $00d0 spie spe swom mstr cpol cpha ssoe lsbf sp0cr1 $00d1 0 0 0 0 0 0 sswai spc0 sp0cr2 $00d2 0 0 0 0 0 spr2 spr1 spr0 sp0br $00d3 spif wcol 0 modf 0 0 0 0 sp0sr $00d4 0 0 0 0 0 0 0 0 reserved $00d5 bit 7 6 5 4 3 2 1 bit 0 sp0dr $00d6 ps7 ps6 ps5 ps4 ps3 ps2 ps1 ps0 ports $00d7 dds7 dds6 dds5 dds4 dds3 dds2 dds1 dds0 ddrs $00d8? $00da 0 0 0 0 0 0 0 0 reserved $00db 0 rdps2 rdps1 rdps0 0 pups2 pups1 pups0 purds $00dc? $00df 0 0 0 0 0 0 0 0 reserved table 8 mc68hc912bl16 register map (sheet 4 of 5) address bit 7 6 5 4 3 2 1 bit 0 name f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 24 MC68HC912BL16TS/d $00e0 0 0 0 0 sldv3 sldv2 sldv1 sldv0 slow $00e1 tstsmd bcss 0 0 tstout 3 tstout 2 tstout 1 tstout 0 cgtcfg $00e2 $00ef 0 0 0 0 0 0 0 0 reserved $00f0 nosec 1 1 1 1 eeswai protlck eerc eemcr $00f1 1 1 1 bprot4 bprot3 bprot2 bprot1 bprot0 eeprot $00f2 eeodd eeven marg eecpd eecprd 0 eecpm 0 eetst $00f3 bulkp 0 0 byte row erase eelat eepgm eeprog $00f4 0 0 0 0 0 0 0 lock feelck $00f5 0 0 0 0 0 0 0 bootp feemcr $00f6 fste gadr hvt fenlv fdisvfp vtck stre mwpr feetst $00f7 0 0 0 feeswai svfp eras lat enpe feectl $00f8? $01ff reserved notes: 1. port a, port b, and data direction registers ddra and ddrb are not in map in expanded and peripheral modes. 2. port e and ddre not in map in peripheral mode; also not in map in expanded modes with eme set. 3. not in map in peripheral mode. table 8 mc68hc912bl16 register map (sheet 5 of 5) address bit 7 6 5 4 3 2 1 bit 0 name f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 25 5 operating modes and resource mapping eight possible operating modes determine the operating configuration of the mc68hc912bl16. each mode has an associated default memory map and external bus configuration. after reset, most system resources can be mapped to other addresses by writing to the appropriate control registers. 5.1 operating modes the operating mode out of reset is determined by the states of the bkgd, modb, and moda pins dur- ing reset. the smodn, modb, and moda bits in the mode register show current operating mode and provide limited mode switching during operation. the states of the bkgd, modb, and moda pins are latched into these bits on the rising edge of the reset signal. during reset an active pull-up is connected to the bkgd pin (as input) and active pulldowns are connected to the modb and moda pins. if an open oc- curs on any of these pins, the device will operate in normal single-chip mode. there are two basic types of operating modes: normal modes ?some registers and bits are protected against accidental changes. special modes ?allow greater access to protected control registers and bits for special purposes such as testing and emulation. a system development and debug feature, background debug mode (bdm), is available in all modes. in special single-chip mode, bdm is active immediately after reset. 5.1.1 normal operating modes these modes provide three operating configurations. background debugging is available in all three modes, but must first be enabled for some operations by means of a bdm command. bdm can then be made active by another bdm command. normal expanded wide mode ?this is a normal mode of operation in which the address and data are multiplexed onto ports a and b. addr[15:8] and data[15:8] are present on port a. addr[7:0] and data[7:0] are present on port b. normal expanded narrow mode ?port a is configured as the high byte of address multiplexed with the 8-bit data bus. port b is configured as the lower 8-bit address bus. this mode is used for lower cost production systems that use 8-bit wide external eeproms or rams. such systems take extra bus cy- cles to access 16-bit locations but this may be preferred over the extra cost of additional external mem- ory devices. table 9 mode selection bkgd modb moda mode port a port b 0 0 0 special single chip general-purpose i/o general-purpose i/o 0 0 1 special expanded narrow addr[15:8]/data[7:0] addr[7:0] 0 1 0 special peripheral addr/data addr/data 0 1 1 special expanded wide addr/data addr/data 1 0 0 normal single chip general-purpose i/o general-purpose i/o 1 0 1 normal expanded narrow addr[15:8]/data[7:0] addr[7:0] 1 1 0 reserved (forced to peripheral) 1 1 1 normal expanded wide addr/data addr/data f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 26 MC68HC912BL16TS/d normal single-chip mode ?there are no external address and data buses in this mode. all pins of ports a, b and e are configured as general-purpose i/o pins. port e bits 1 and 0 are input-only with internal pull-ups and the other 22 pins are bidirectional i/o pins that are initially configured as high-im- pedance inputs. port e pull-ups are enabled upon reset; port a and b pull-ups are disabled upon reset. 5.1.2 special operating modes there are three special operating modes that correspond to normal operating modes. these operating modes are commonly used in factory testing and system development. in addition, there is a special peripheral mode, in which an external master, such as an i.c. tester, can control the on-chip peripher- als. special expanded wide mode ?this mode can be used for emulation of normal expanded wide mode and emulation of normal single-chip mode and 16-bit data bus. the bus control related pins in porte are all configured to serve their bus control output functions rather than general-purpose i/o. special expanded narrow mode ?this mode can be used for emulation of normal expanded narrow mode. in this mode external 16-bit data is handled as two back-to-back bus cycles, one for the high byte followed by one for the low byte. internal operations continue to use full 16-bit data paths. special single-chip mode ?this mode can be used to force the mcu to active bdm mode to allow system debug through the bkgd pin. the mcu does not fetch the reset vector and execute application code as it would in other modes. instead, the active background mode is in control of cpu execution and bdm firmware is waiting for additional serial commands through the bkgd pin. there are no ex- ternal address and data buses in this mode. the mcu operates as a stand-alone device and all program and data space are on-chip. external port pins can be used for general-purpose i/o. special peripheral mode ?the cpu is not active in this mode. an external master can control on- chip peripherals for testing purposes. it is not possible to change to or from this mode without going through reset. background debugging should not be used while the mcu is in special peripheral mode as internal bus conflicts between bdm and the external master can cause improper operation of both modes. 5.2 background debug mode background debug mode (bdm) is an auxiliary operating mode that is used for system development. bdm is implemented in on-chip hardware and provides a full set of debug operations. some bdm com- mands can be executed while the cpu is operating normally. other bdm commands are firmware based, and require the bdm firmware to be enabled and active for execution. in special single-chip mode, bdm is enabled and active immediately out of reset. bdm is available in all other operating modes, but must be enabled before it can be activated. bdm should not be used in special peripheral mode because of potential bus conflicts. once enabled, background mode can be made active by a serial command sent via the bkgd pin or execution of a cpu12 bgnd instruction. while background mode is active, the cpu can interpret spe- cial debugging commands, and read and write cpu registers, peripheral registers, and locations in memory. while bdm is active, the cpu executes code located in a small on-chip rom mapped to addresses $ff00 to $ffff; bdm control registers are accessible at addresses $ff00 to $ff06. the bdm rom replaces the regular system vectors while bdm is active. while bdm is active, the user memory from $ff00 to $ffff is not in the map except through serial bdm commands. bdm allows read and write access to internal memory-mapped registers and ram, and read access to eeprom and flash eeprom without interrupting the application code executing in the cpu. this non- intrusive mode uses dead bus cycles to access the memory and in most cases will remain cycle deter- ministic. refer to 16 development support for more details on bdm. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 27 mode controls the mcu operating mode and various configuration options. this register is not in the map in peripheral mode. smodn, modb, moda ?mode select special, b and a these bits show the current operating mode and reflect the status of the bkgd, modb and moda input pins at the rising edge of reset. read anytime. smodn may only be written if smodn = 0 (in special modes) but the first write is ig- nored; modb, moda may be written once if smodn = 1; anytime if smodn = 0, except that special peripheral and reserved modes cannot be selected. estr ?e clock stretch enable determines if the e clock behaves as a simple free-running clock or as a bus control signal that is active only for external bus cycles. estr is always one in expanded modes since it is required for address demultiplexing and must follow stretched cycles. 0 = e never stretches (always free running). 1 = e stretches high during external access cycles and low during non-visible internal accesses. normal modes: write once; special modes: write anytime, read anytime. ivis ?internal visibility this bit determines whether internal addr/data, r/w , and lstrb signals can be seen on the bus during accesses to internal locations. in special expanded narrow mode, it is possible to con?ure the mcu to show internal accesses on an external 16-bit bus. the ivis control bit must be set to one. when the system is con?ured this way, visible internal accesses are shown as if the mcu was con?ured for expanded wide mode but normal external accesses operate as if the bus was in narrow mode. in normal expanded narrow mode, internal visibility is not allowed and ivis is ignored. 0 = no visibility of internal bus operations on external bus 1 = internal bus operations are visible on external bus normal modes: write once; special modes: write anytime except the first time. read anytime. ebswai ?external bus module stop in wait control this bit controls access to the external bus interface when in wait mode. the module will delay before shutting down in wait mode to allow for ?al bus activity to complete. 0 = external bus and registers continue functioning during wait mode. 1 = external bus is shut down during wait mode. mode mode register $000b bit 7 6 5 4 3 2 1 bit 0 smodn modb moda estr ivis ebswai 0 eme reset: 1 0 1 1 0 0 0 normal exp narrow reset: 1 1 1 1 0 0 0 normal exp wide reset: 0 0 1 1 1 0 1 special exp narrow reset: 0 1 1 1 1 0 1 special exp wide reset: 0 1 0 1 1 0 1 peripheral reset: 1 0 0 1 0 0 0 normal single chip reset: 0 0 0 1 1 0 1 special single chip f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 28 MC68HC912BL16TS/d eme ?emulate port e removing the registers from the map allows the user to emulate the function of these registers exter- nally. in single-chip mode porte and ddre are always in the map regardless of the state of this bit. 0 = porte and ddre are in the memory map. 1 = porte and ddre are removed from the internal memory map (expanded mode). normal modes: write once; special modes: write anytime except the first time. read anytime. 5.3 internal resource mapping the internal register block, ram, flash eeprom and eeprom have default locations within the 64- kbyte standard address space but may be reassigned to other locations during program execution by setting bits in mapping registers initrg, initrm, and initee. during normal operating modes these registers can be written once. it is advisable to explicitly establish these resource locations during the initialization phase of program execution, even if default values are chosen, in order to protect the reg- isters from inadvertent modification later. writes to the mapping registers go into effect between the cycle that follows the write and the cycle after that. to assure that there are no unintended operations, a write to one of these registers should be fol- lowed with a nop instruction. if conflicts occur when mapping resources, the register block will take precedence over the other re- sources; ram, flash eeprom, or eeprom addresses occupied by the register block will not be avail- able for storage. when active, bdm rom takes precedence over other resources although a conflict between bdm rom and register space is not possible. table 10 shows resource mapping precedence. in expanded modes, all address space not utilized by internal resources is by default external memory. 5.3.1 register block mapping after reset the 512 byte register block resides at location $0000 but can be reassigned to any 2-kbyte boundary within the standard 64-kbyte address space. mapping of internal registers is controlled by five bits in the initrg register. the register block occupies the first 512 bytes of the 2-kbyte block. reg[15:11] ?internal register map position these bits specify the upper five bits of the 16-bit registers address. write once in normal modes or anytime in special modes. read anytime. mmswai ?memory mapping interface stop in wait control this bit controls access to the memory mapping interface when in wait mode. table 10 mapping precedence precedence resource 1 bdm rom (if active) 2 register space 3 ram 4 eeprom 5 flash eeprom 6 external memory initrg initialization of internal register position register $0011 bit 7 6 5 4 3 2 1 bit 0 reg15 reg14 reg13 reg12 reg11 0 0 mmswai reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 29 0 = memory mapping interface continues to function during wait mode. 1 = memory mapping interface access is shut down during wait mode. 5.3.2 ram mapping the mc68hc912bl16 has 512byte of fully static ram that is used for storing instructions, variables, and temporary data during program execution. after reset, ram addressing begins at location $0800 but can be assigned to any 2-kbyte boundary within the standard 64-kbyte address space. mapping of internal ram is controlled by five bits in the initrm register. the ram array occupies the first 512byte of the 2-kbyte block. ram[15:11] ?internal ram map position these bits specify the upper five bits of the 16-bit ram address. write once in normal modes or anytime in special modes. read anytime. 5.3.3 eeprom mapping the mc68hc912bl16 has 512 bytes of eeprom which is activated by the eeon bit in the initee register. mapping of internal eeprom is controlled by four bits in the initee register. after reset eeprom ad- dress space begins at location $0e00 but can be mapped to any 4-kbyte boundary within the standard 64-kbyte address space. ee[15:12] ?internal eeprom map position these bits specify the upper four bits of the 16-bit eeprom address. write once in normal modes or anytime in special modes. read anytime. eeon ?internal eeprom on (enabled) the eeon bit allows read access to the eeprom array. eeprom control registers can be accessed and eeprom locations may be programmed or erased regardless of the state of eeon. this bit is forced to one in single-chip modes. read or write anytime. 0 = removes the eeprom from the map 1 = places the on-chip eeprom in the memory map 5.3.4 flash eeprom and expansion address mapping additional mapping controls are available that can be used in conjunction with flash eeprom and memory expansion. the 16-kbyte flash eeprom can be mapped to either the upper or lower half of the 64-kbyte address space. when mapping conflicts occur, registers, ram and eeprom have priority over flash eeprom. to use memory expansion the part must be operated in one of the expanded modes. initrm initialization of internal ram position register $0010 bit 7 6 5 4 3 2 1 bit 0 ram15 ram14 ram13 ram12 ram11 0 0 0 reset: 0 0 0 0 1 0 0 0 initee ? initialization of internal eeprom position register $0012 bit 7 6 5 4 3 2 1 bit 0 ee15 ee14 ee13 ee12 0 0 0 eeon reset: 0 0 0 0 0 0 0 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 30 MC68HC912BL16TS/d this register can be read anytime. in normal modes misc can be written once; in special modes it can be written anytime. ndrf ?narrow data bus for register-following map this bit enables a narrow bus feature for the 512-byte register-following map. in expanded narrow (eight bit) modes, single-chip modes, and peripheral mode, ndrf has no effect. the register-following map always begins at the byte following the 512-byte register map. if the registers are moved this space will also move. 0 = register-following map space acts as a full 16-bit data bus 1 = register-following map space acts the same as an 8-bit external data bus rfstr1, rfstr0 ?register-following stretch bit 1 and bit 0 these bits determine the amount of clock stretch on accesses to the 512-byte register-following map. it is valid regardless of the state of the ndrf bit. in single-chip and peripheral modes this bit has no meaning or effect. exstr1, exstr0 ?external access stretch bit 1 and bit 0 these bits determine the amount of clock stretch on accesses to the external address space. in single- chip and peripheral modes this bit has no meaning or effect. maprom ?map location of flash eeprom this bit determines the location of the on-chip flash eeprom. in expanded modes it is reset to zero. in single-chip modes it is reset to one. if romon is zero, this bit has no meaning or effect. 0 = flash eeprom is located from $4000 to $7fff 1 = flash eeprom is located from $c000 to $ffff misc miscellaneous mapping control register $0013 bit 7 6 5 4 3 2 1 bit 0 0 ndrf rfstr1 rfstr0 exstr1 exstr0 maprom romon reset: 0 0 0 0 1 1 0 0 ex. modes reset: 0 0 0 0 1 1 1 1 sing. chip table 11 register-following stretch-bit definition stretch bit rfstr1 stretch bit rfstr0 e clocks stretched 0 0 0 0 1 1 1 0 2 1 1 3 table 12 expanded stretch-bit definition stretch bit exstr1 stretch bit exstr0 e clocks stretched 0 0 0 0 1 1 1 0 2 1 1 3 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 31 romon ?enable flash eeprom in expanded modes romon is reset to zero. in single-chip modes it is reset to one. if the internal ram, registers, eeprom, or bdm rom (if active) are mapped to the same space as the flash eeprom, they will have priority over the flash eeprom. 0 = disables the flash eeprom in the memory map 1 = enables the flash eeprom in the memory map 5.4 memory maps the following diagrams illustrate the memory map for each mode of operation immediately after reset. figure 6 mc68hc912bl16 memory map bdm (if active) hc912bl16 mem map $ffff $ffff flash eeprom $0000 $0800 $0e00 $0fff $ff00 $0000 $01ff $0800 single chip special single chip normal expanded $8000 vectors vectors vectors $ff00 $f000 512 bytes eeprom map t o any 4k space 512 byte ram map t o any 2k space registers map t o any 2k space $ffff $ffc0 $09ff map with maprom bit $0e00 512 bytes ram $7fff in misc register to $4000 ?$7fff or $c000 ?$ffff $0200 $03ff register following space 512 bytes ram $c000 $c000 $4000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 32 MC68HC912BL16TS/d 6 bus control and input/output internally the mc68hc912bl16 has full 16-bit data paths, but depending upon the operating mode and control registers, the external bus may be eight or sixteen bits. there are cases where 8-bit and 16-bit accesses can appear on adjacent cycles using the lstrb signal to indicate 8- or 16-bit data. 6.1 detecting access type from external signals the external signals lstrb , r/w , and a0 can be used to determine the type of bus access that is tak- ing place. accesses to the internal ram module are the only type of access that produce lstrb =a0=1, because the internal ram is specifically designed to allow misaligned 16-bit accesses in a single cycle. in these cases the data for the address that was accessed is on the low half of the data bus and the data for address + 1 is on the high half of the data bus (data order is swapped). 6.2 registers not all registers are visible in the mc68hc912bl16 memory map under certain conditions. in special peripheral mode the first 16 registers associated with bus expansion are removed from the memory map. in expanded modes, some or all of port a, port b, and port e are used for expansion buses and control signals. in order to allow emulation of the single-chip functions of these ports, some of these registers must be rebuilt in an external port replacement unit. in any expanded mode port a and port b are used for address and data lines so registers for these ports, as well as the data direction registers for these ports, are removed from the on-chip memory map and become external accesses. in any expanded mode, port e pins may be needed for bus control (e.g., eclk, r/w ). to regain the single-chip functions of port e, the emulate port e (eme) control bit in the mode register may be set. in this special case of expanded mode and eme set, porte and ddre registers are removed from the on-chip memory map and become external accesses so port e may be rebuilt externally. table 13 access type vs. bus control pins lstrb a0 r/w type of access 1 0 1 8-bit read of an even address 0 1 1 8-bit read of an odd address 1 0 0 8-bit write to an even address 0 1 0 8-bit write to an odd address 0 0 1 16-bit read of an even address 1 1 1 16-bit read of an odd address (low/high data swapped) 0 0 0 16-bit write to an even address 1 1 0 16-bit write to an even address (low/high data swapped) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 33 bits pa[7:0] are associated with addresses addr[15:8] and data[15:8]. when this port is not used for external addresses and data, such as in single-chip mode, these pins can be used as general-purpose i/o. ddra determines the primary direction of each pin. this register is not in the on-chip map in ex- panded and peripheral modes. read and write anytime. this register determines the primary direction for each port a pin when functioning as a general-purpose i/o port. ddra is not in the on-chip map in expanded and peripheral modes. read and write anytime. 0 = associated pin is a high-impedance input 1 = associated pin is an output bits pb[7:0] are associated with addresses addr[7:0] and data[7:0]. when this port is not used for external addresses and data such as in single-chip mode, these pins can be used as general-purpose i/o. ddrb determines the primary direction of each pin. this register is not in the on-chip map in ex- panded and peripheral modes. read and write anytime. this register determines the primary direction for each port b pin when functioning as a general-purpose i/o port. ddrb is not in the on-chip map in expanded and peripheral modes. read and write anytime. 0 = associated pin is a high-impedance input 1 = associated pin is an output porta ? port a register $0000 bit 7 6 5 4 3 2 1 bit 0 single chip pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 reset: exp wide & periph: addr15 data15 addr14 data14 addr13 data13 addr12 data12 addr11 data11 addr10 data10 addr9 data9 addr8 data8 expanded narrow addr15 data15/7 addr14 data14/6 addr13 data13/5 addr12 data12/4 addr11 data11/3 addr10 data10/2 addr9 data9/1 addr8 data8/0 ddra ? port a data direction register $0002 bit 7 6 5 4 3 2 1 bit 0 dda7 dda6 dda5 dda4 dda3 dda2 dda1 dda0 reset: 0 0 0 0 0 0 0 0 portb ? port b register $0001 bit 7 6 5 4 3 2 1 bit 0 single chip pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 reset: exp wide & periph: addr7 data7 addr6 data6 addr5 data5 addr4 data4 addr3 data3 addr2 data2 addr1 data1 addr0 data0 expanded narrow addr7 addr6 addr5 addr4 addr3 addr2 addr1 addr0 ddrb ? port b data direction register $0003 bit 7 6 5 4 3 2 1 bit 0 ddb7 ddb6 ddb5 ddb4 ddb3 ddb2 ddb1 ddb0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 34 MC68HC912BL16TS/d this register is associated with external bus control signals and interrupt inputs including data bus en- able (dbe ), mode select (modb/ipipe1, moda/ipipe0), e clock, data size (lstrb /t a glo ), read/ write (r/w ), irq , and xirq . when the associated pin is not used for one of these specific functions, the pin can be used as general-purpose i/o. the port e assignment register (pear) selects the function of each pin. ddre determines the primary direction of each port e pin when configured to be general- purpose i/o. some of these pins have software selectable pull-ups (dbe , lstrb , r/w , irq, and xirq ). a single control bit enables the pull-ups for all these pins which are configured as inputs. this register is not in the map in peripheral mode or expanded modes when the eme bit is set. read and write anytime. this register determines the primary direction for each port e pin configured as general-purpose i/o. 0 = associated pin is a high-impedance input 1 = associated pin is an output pe[1:0] are associated with xirq and irq and cannot be configured as outputs. these pins can be read regardless of whether the alternate interrupt functions are enabled. this register is not in the map in peripheral mode and expanded modes while the eme control bit is set. read and write anytime. the pear register is used to choose between the general-purpose i/o functions and the alternate bus control functions of port e. when an alternate control function is selected, the associated ddre bits are overridden. the reset condition of this register depends on the mode of operation because bus-control signals are needed immediately after reset in some modes. in normal single-chip mode , no external bus control signals are needed so all of port e is configured for general-purpose i/o. porte ? port e register $0008 bit 7 6 5 4 3 2 1 bit 0 single chip pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 reset: alt. pin function dbe modb or ipipe1 moda or ipipe0 eclk lstrb or t a glo r/w irq xirq ddre ? port e data direction register $0009 bit 7 6 5 4 3 2 1 bit 0 dde7 dde6 dde5 dde4 dde3 dde2 0 0 reset: 0 0 0 0 0 0 pear ? port e assignment register $000a bit 7 6 5 4 3 2 1 bit 0 ndbe 0 pipoe neclk lstre rdwe 0 0 reset: 0 0 0 0 0 normal expanded reset: 0 1 0 1 1 special expanded reset: 1 0 1 0 0 peripheral reset: 1 0 1 0 0 normal single chip reset: 0 1 0 1 1 special single chip f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 35 in special single-chip mode , the e clock is enabled as a timing reference and the other bits of port e are configured for general-purpose i/o. in normal expanded modes , the reset vector is located in external memory. the e clock may be required for this access but r/w is only needed by the system when there are external writable resources. there- fore in normal expanded modes, only the e clock is configured for its alternate bus control function and the other bits of port e are configured for general-purpose i/o. if the normal expanded system needs any other bus-control signals, pear would need to be written before any access that needed the addi- tional signals. in special expanded modes , ipipe1, ipipe0, e, r/w , and lstrb are configured as bus-control signals. in peripheral mode , the pear register is not accessible for reads or writes. ndbe ?no data bus enable read and write anytime. 0 = pe7 is used for external control of data enables on memories. 1 = pe7 is used for general-purpose i/o. pipoe ?pipe signal output enable normal: write once; special: write anytime except the first time. read anytime. this bit has no effect in single chip modes. 0 = pe[6:5] are general-purpose i/o. 1 = pe[6:5] are outputs and indicate the state of the instruction queue. neclk ?no external e clock in expanded modes, writes to this bit have no effect. e clock is required for de-multiplexing the external address; neclk will remain zero in expanded modes. neclk can be written once in normal single- chip mode and can be written anytime in special single chip mode. the bit can be read anytime. 0 = pe4 is the external e-clock pin subject to the following limitation: in single-chip modes, pe4 is general-purpose i/o unless neclk = 0 and either ivis = 1 or estr = 0. a 16-bit write to pear:mode can configure all three bits in one operation. 1 = pe4 is a general-purpose i/o pin. lstre ?low strobe (lstrb ) enable normal: write once; special: write anytime except the first time. read anytime. this bit has no effect in single-chip modes or normal expanded narrow mode. 0 = pe3 is a general-purpose i/o pin. 1 = pe3 is configured as the lstrb bus-control output, provided the mcu is not in single chip or normal expanded narrow modes. lstrb is used during external writes. after reset in normal expanded mode, lstrb is disabled. if needed, it should be enabled before external writes. external reads do not normally need lstrb be- cause all 16 data bits can be driven even if the mcu only needs eight bits of data. t a glo is a shared function of the pe3/lstrb pin. in special expanded modes with lstre set and the bdm instruction tagging on, a zero at the falling edge of e tags the instruction word low byte being read into the instruction queue. rdwe ?read/write enable normal: write once; special: write anytime except the first time. read anytime. this bit has no effect in single-chip modes. 0 = pe2 is a general-purpose i/o pin. 1 = pe2 is configured as the r/w pin. in single-chip modes, rdwe has no effect and pe2 is a gen- eral-purpose i/o pin. r/w is used for external writes. after reset in normal expanded mode, it is disabled. if needed it should be enabled before any external writes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 36 MC68HC912BL16TS/d these bits select pull-up resistors for any pin in the corresponding port that is currently configured as an input. this register is not in the map in peripheral mode. read and write anytime. pupe ?pull-up port e enable pins pe6, pe5, and pe4 never have pull-ups. 0 = port e pull-ups on pe7, pe3, pe2, pe1, and pe0 are disabled. 1 = enable pull-up devices for port e input pins pe7, pe3, pe2, pe1, and pe0. pupb ?pull-up port b enable 0 = port b pull-ups are disabled. 1 = enable pull-up devices for all port b input pins. this bit has no effect if port b is being used as part of the address/data bus (the pull-ups are inactive). pupa ?pull-up port a enable 0 = port a pull-ups are disabled. 1 = enable pull-up devices for all port a input pins. this bit has no effect if port a is being used as part of the address/data bus (the pull-ups are inactive). these bits select reduced drive for the associated port pins. this gives reduced power consumption and reduced rfi with a slight increase in transition time (depending on loading). the reduced drive function is independent of which function is being used on a particular port. this register is not in the map in peripheral mode. normal: write once; special: write anytime except the first time. read anytime. rdpe ?reduced drive of port e 0 = all port e output pins have full drive enabled. 1 = all port e output pins have reduced drive capability. rdpb ?reduced drive of port b 0 = all port b output pins have full drive enabled. 1 = all port b output pins have reduced drive capability. rdpa ?reduced drive of port a 0 = all port a output pins have full drive enabled. 1 = all port a output pins have reduced drive capability. pucr ? pull-up control register $000c bit 7 6 5 4 3 2 1 bit 0 0 0 0 pupe 0 0 pupb pupa reset: 0 0 0 1 0 0 0 0 rdriv reduced drive of i/o lines $000d bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 rdpe 0 rdpb rdpa reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 37 7 flash eeprom the 16-kbyte flash eeprom module for the mc68hc912bl16 serves as electrically erasable and programmable, non-volatile rom emulation memory. the module can be used for program code that must either execute at high speed or is frequently executed, such as operating system kernels and stan- dard subroutines, or it can be used for static data which is read frequently. the flash eeprom is ideal for program storage for single-chip applications allowing for field reprogramming. 7.1 overview the flash eeprom array is arranged in a 16-bit configuration and may be read as either bytes, aligned words or misaligned words. access time is one bus cycle for byte and aligned word access and two bus cycles for misaligned word operations. the flash eeprom module requires an external program/erase voltage (v fp ) to program or erase the flash eeprom array. the external program/erase voltage is provided to the flash eeprom module via an external v fp pin. to prevent damage to the flash array, v fp should always be greater than or equal to v dd -0 .5v. programming is by byte or aligned word. the flash eeprom module supports bulk erase only. the flash eeprom module has hardware interlocks which protect stored data from accidental corrup- tion. an erase- and program-protected 2-kbyte block for boot routines is located at $7800?7fff or $f800?ffff depending upon the mapped location of the flash eeprom array. 7.2 flash eeprom control block a 4-byte register block controls the flash eeprom module operation. configuration information is specified and programmed independently from the contents of the flash eeprom array. at reset, the 4-byte register section starts at address $00f4. 7.3 flash eeprom array after reset, the flash eeprom array is located from addresses $c000 to $ffff in single-chip mode. in expanded modes the flash eeprom array is located from address $4000 to $7fff, however, it is turned off. the flash eeprom can be mapped to an alternate address range. see 5 operating modes and resource mapping . 7.4 flash eeprom registers in normal modes the lock bit can only be written once after reset. lock ?lock register bit 0 = enable write to feemcr register 1 = disable write to feemcr register feelck flash eeprom lock control register $00f4 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 0 lock reset: 0 0 0 0 0 0 0 0 feemcr ?flash eeprom module configuration register $00f5 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 0 bootp reset: 0 0 0 0 0 0 0 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 38 MC68HC912BL16TS/d this register controls the operation of the flash eeprom array. bootp cannot be changed when the lock control bit in the feelck register is set or if enpe in the feectl register is set. bootp ?boot protect the boot block is located at $7800?7fff or $f800?ffff depending upon the mapped location of the flash eeprom array. 0 = enable erase and program of 2-kbyte boot block 1 = disable erase and program of 2-kbyte boot block in normal mode, writes to feetst control bits have no effect and always read zero. the flash eeprom module cannot be placed in test mode inadvertently during normal operation. fste ?stress test enable 0 = disables the gate/drain stress circuitry 1 = enables the gate/drain stress circuitry gadr ?gate/drain stress test select 0 = selects the drain stress circuitry 1 = selects the gate stress circuitry hvt ?stress test high voltage status 0 = high voltage not present during stress test 1 = high voltage present during stress test fenlv ?enable low voltage 0 = disables low voltage transistor in current reference circuit 1 = enables low voltage transistor in current reference circuit fdisvfp ?disable status v fp voltage lock when the v fp pin is below normal programming voltage the flash module will not allow writing to the lat bit; the user cannot erase or program the flash module. the fdisvfp control bit enables writing to the lat bit regardless of the voltage on the v fp pin. 0 = enable the automatic lock mechanism if v fp is low 1 = disable the automatic lock mechanism if v fp is low vtck ?v t check test enable when vtck is set, the flash eeprom module uses the v fp pin to control the control gate voltage; the sense amp time-out path is disabled. this allows for indirect measurements of the bit cells program and erase threshold. if v fp < v zbrk (breakdown voltage) the control gate will equal the v fp voltage. if v fp > v zbrk the control gate will be regulated by the following equation: vcontrol gate = v zbrk + 0.44 (v fp - v zbrk ) 0 = v t test disable 1 = v t test enable stre ?spare test row enable the spare test row consists of one flash eeprom array row. the reserved word at location 31 contains production test information which must be maintained through several erase cycles. when stre is set, the decoding for the spare test row overrides the address lines which normally select the other rows in the array. feetst ?flash eeprom module test register $00f6 bit 7 6 5 4 3 2 1 bit 0 fste gadr hvt fenlv fdisvfp vtck stre mwpr reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 39 0 = lib accesses are to the flash eeprom array 1 = spare test row in array enabled if smod is active mwpr ?multiple word programming used primarily for testing, if mpwr = 1, the two least-significant address lines addr[1:0] will be ignored when programming a flash eeprom location. the word location addressed if addr[1:0] = 00, along with the word location addressed if addr[1:0] = 10, will both be programmed with the same word data from the programming latches. this bit should not be changed during programming. 0 = multiple word programming disabled 1 = program 32 bits of data this register controls the programming and erasure of the flash eeprom. feeswai ?flash eeprom stop in wait control 0 = do not halt flash eeprom clock when the part is in wait mode. 1 = halt flash eeprom clock when the part is in wait mode. note the feeswai bit cannot be asserted if the interrupt vector resides in theflash eeprom array. svfp ?status v fp voltage svfp is a read only bit. 0 = voltage of v fp pin is below normal programming voltage levels 1 = voltage of v fp pin is above normal programming voltage levels eras ?erase control this bit can be read anytime or written when enpe = 0. when set, all locations in the array will be erased at the same time. the boot block will be erased only if bootp = 0. this bit also affects the result of attempted array reads. see table 14 for more information. status of eras cannot change if enpe is set. 0 = flash eeprom configured for programming 1 = flash eeprom configured for erasure lat ?latch control this bit can be read anytime or written when enpe = 0. when set, the flash eeprom is configured for programming or erasure and, upon the next valid write to the array, the address and data will be latched for the programming sequence. see table 14 for the effects of lat on array reads. a high volt- age detect circuit on the v fp pin will prevent assertion of the lat bit when the programming voltage is at normal levels. 0 = programming latches disabled 1 = programming latches enabled feectl ?flash eeprom control register $00f7 bit 7 6 5 4 3 2 1 bit 0 0 0 0 feeswai svfp eras lat enpe reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 40 MC68HC912BL16TS/d enpe ?enable programming/erase 0 = disables program/erase voltage to flash eeprom 1 = applies program/erase voltage to flash eeprom enpe can be asserted only after lat has been asserted and a write to the data and address latches has occurred. if an attempt is made to assert enpe when lat is negated, or if the latches have not been written to after lat was asserted, enpe will remain negated after the write cycle is complete. the lat, eras and bootp bits cannot be changed when enpe is asserted. a write to feectl may only affect the state of enpe. attempts to read a flash eeprom array location in the flash eeprom module while enpe is asserted will not return the data addressed. see table 14 for more information. flash eeprom module control registers may be read or written while enpe is asserted. if enpe is asserted and lat is negated on the same write access, no programming or erasure will be performed. 7.5 operation the flash eeprom can contain program and data. on reset, it can operate as a bootstrap memory to provide the cpu with internal initialization information during the reset sequence. 7.5.1 bootstrap operation single-chip mode after reset, the cpu controlling the system will begin booting up by fetching the first program address from address $fffe. 7.5.2 normal operation the flash eeprom allows a byte or aligned word read/write in one bus cycle. misaligned word read/ write require an additional bus cycle. the flash eeprom array responds to read operations only. write operations are ignored. 7.5.3 program/erase operation an unprogrammed flash eeprom bit has a logic state of one. a bit must be programmed to change its state from one to zero. erasing a bit returns it to a logic one. the flash eeprom has a minimum program/erase life of 100 cycles. programming or erasing the flash eeprom is accomplished by a se- ries of control register writes and a write to a set of programming latches. programming is restricted to a single byte or aligned word at a time as determined by internal signal sz8 and addr[0]. the flash eeprom must first be completely erased prior to programming final data values. it is possible to program a location in the flash eeprom without erasing the entire array if the new value does not require the changing of bit values from zero to one. read/write accesses during program/erase ?during program or erase operations, read and write accesses may be different from those during normal operation and are affected by the state of the con- trol bits in the flash eeprom control register (feectl). the next write to any valid address to the ar- ray after lat is set will cause the address and data to be latched into the programming latches. once the address and data are latched, write accesses to the array will be ignored while lat is set. writes to the control registers will occur normally. program/erase verification ?when programming or erasing the flash eeprom array, a special verification method is required to ensure that the program/erase process is reliable, and also to provide table 14 effects of enpe, lat and eras on array reads enpe lat eras result of read 0 0 normal read of location addressed 0 1 0 read of location being programmed 0 1 1 normal read of location addressed 1 read cycle is ignored f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 41 the longest possible life expectancy. this method requires stopping the program/erase sequence at pe- riods of t ppulse (t epulse for erasing) to determine if the flash eeprom is programmed/erased. after the location reaches the proper value, it must continue to be programmed/erased with additional margin pulses to ensure that it will remain programmed/erased. failure to provide the margin pulses could lead to corrupted or unreliable data. program/erase sequence ?to begin a program or erase sequence the external v fp voltage must be applied and stabilized. the eras bit must be set or cleared, depending on whether a program se- quence or an erase sequence is to occur. the lat bit will be set to cause any subsequent data written to a valid address within the flash eeprom to be latched into the programming address and data latch- es. the next flash array write cycle must be either to the location that is to be programmed if a pro- gramming sequence is being performed, or, if erasing, to any valid flash eeprom array location. writing the new address and data information to the flash eeprom is followed by assertion of enpe to turn on the program/erase voltage to program/erase the new location(s). the lat bit must be assert- ed and the address and data latched to allow the setting of the enpe control bit. if the data and address have not been latched, an attempt to assert enpe will be ignored and enpe will remain negated after the write cycle to feectl is completed. the lat bit must remain asserted and the eras bit must re- main in its current state as long as enpe is asserted. a write to the lat bit to clear it while enpe is set will be ignored. that is, after the write cycle, lat will remain asserted. likewise, an attempt to change the state of eras will be ignored and the state of the eras bit will remain unchanged. the programming software is responsible for all timing during a program sequence. this includes the total number of program pulses (n pp ), the length of the program pulse (t ppulse ), the program margin pulses (p m ) and the delay between turning off the high voltage and verifying the operation (t vprog ). the erase software is responsible for all timing during an erase sequence. this includes the total num- ber of erase pulses (e m ), the length of the erase pulse (t epulse ), the erase margin pulse or pulses, and the delay between turning off the high voltage and verifying the operation (t verase ). software also controls the supply of the proper program/erase voltage to the v fp pin, and should be at the proper level before enpe is set during a program/erase sequence. a program/erase cycle should not be in progress when starting another program/erase, or while at- tempting to read from the array. note although clearing enpe disables the program/erase voltage (v fp ) from the v fp pin to the array, care must be taken to ensure that v fp is at v dd whenever pro- gramming/erasing is not in progress. not doing so could damage the part. ensuring that v fp is always greater or equal to v dd can be accomplished by controlling the v fp power supply with the programming software via an output pin. alternatively, all programming and erasing can be done prior to installing the device on an appli- cation circuit board which can always connect v fp to v dd . programming can also be accomplished by plugging the board into a special programming fixture which provides program/erase voltage to the v fp pin. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 42 MC68HC912BL16TS/d 7.6 programming the flash eeprom programming the flash eeprom is accomplished by the following sequence. the v fp pin voltage must be at the proper level prior to executing step 4 the first time. 1. apply program/erase voltage to the v fp pin. 2. clear eras and set the lat bit in the feectl register to establish program mode and enable programming address and data latches. 3. write data to a valid address. the address and data is latched. if bootp is asserted, an at- tempt to program an address in the boot block will be ignored. 4. apply programming voltage by setting enpe. 5. delay for one programming pulse (t ppulse ). 6. remove programming voltage by clearing enpe. 7. delay while high voltage is turning off (t vprog ). 8. read the address location to verify that it has been programmed ?if the location is not programmed, repeat steps 4 through 7 until the location is programmed or until the specified maximum number of program pulses has been reached (n pp ) ?if the location is programmed, repeat the same number of pulses as required to program the location. this provides 100% program margin. 9. read the address location to verify that it remains programmed. 10. clear lat. 11. if there are more locations to program, repeat steps 2 through 10. 12. turn off v fp (reduce voltage on v fp pin to v dd ). the flowchart in figure 7 demonstrates the recommended programming sequence. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 43 figure 7 program sequence flow start prog set lat clear eras write data to address set enpe read get next address/data no location failed location clear margin flag increment n pp counter no decrement n pp counter no yes yes yes to program turn on v fp delay for duration of program pulse (t ppulse ) clear enpe delay before verify is margin flag set? no yes no yes data correct? set margin flag data correct? n pp = 0? done? turn off v fp (t vprog ) n pp = 50? yes no done prog clear program pulse counter (n pp ) clear lat f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 44 MC68HC912BL16TS/d 7.7 erasing the flash eeprom the following sequence demonstrates the recommended procedure for erasing the flash eeprom. the v fp pin voltage must be at the proper level prior to executing step 4 the first time. 1. turn on v fp (apply program/erase voltage to the v fp pin). 2. set the lat bit and eras bit to configure the flash eeprom for erasing. 3. write to any valid address in the flash array. this allows the erase voltage to be turned on; the data written and the address written are not important. the boot block will be erased only if the control bit bootp is negated. 4. apply erase voltage by setting enpe. 5. delay for a single erase pulse (t epulse ). 6. remove erase voltage by clearing enpe. 7. delay while high voltage is turning off (t verase ). 8. read the entire array to ensure that the flash eeprom is erased. ?if all of the flash eeprom locations are not erased, repeat steps 4 through 7 until either the remaining locations are erased, or until the maximum erase pulses have been applied (n ep ) ?if all of the flash eeprom locations are erased, repeat the same number of pulses as re- quired to erase the array. this provides 100% erase margin. 9. read the entire array to ensure that the flash eeprom is erased. 10. clear lat. 11. turn off v fp (reduce voltage on v fp pin to v dd ). the flowchart in figure 8 demonstrates the recommended erase sequence. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 45 figure 8 erase sequence flow start erase set lat set eras write to array set enpe read no array failed to erase array clear margin flag increment n ep counter decrement n ep counter no yes yes turn on v fp delay for duration of erase pulse (t epulse ) clear enpe delay before verify is margin flag set? no yes no yes array erased? set margin flag n ep = 0? turn off v fp (t verase ) n ep = 5? yes no array erased clear erase pulse counter (n ep ) clear lat array erased? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 46 MC68HC912BL16TS/d 7.8 program/erase protection interlocks the flash eeprom program and erase mechanisms provide maximum protection from accidental pro- gramming or erasure. the voltage required to program/erase the flash eeprom (v fp ) is supplied via an external pin. if v fp is not present, no programming/erasing will occur. furthermore, the program/erase voltage will not be applied to the flash eeprom unless turned on by setting a control bit (enpe). the enpe bit may not be set unless the programming address and data latches have been written previously with a valid ad- dress. the latches may not be written unless enabled by setting a control bit (lat). the lat and enpe control bits must be written on separate writes to the control register (feectl) and must be separated by a write to the programming latches. the eras and lat bits are also protected when enpe is set. this prevents inadvertent switching between erase/program mode and also prevents the latched data and address from being changed after a program cycle has been initiated. 7.9 stop or wait mode when stop or wait commands are executed, the mcu puts the flash eeprom in stop or wait mode. in these modes the flash module will cease erasure or programming immediately. it is advised not to enter stop or wait modes when programming the flash array. caution the flash eeprom module is not able to recover from stop without a 1 micro- second delay. this cannot be controlled internal to the mcu. therefore, do not at- tempt to recover from stop with an interrupt. use reset to recover from a stop mode executed from flash eeprom. recovery from a stop instruction executed from eeprom and ram operate normally. 7.10 test mode the flash eeprom has some special test functions which are only accessible when the device is in test mode. test mode is indicated to the flash eeprom module when the smod line on the lib is asserted. when smod is asserted, the special test control bits may be accessed via the lib to invoke the special test functions in the flash eeprom module. when smod is not asserted, writes to the test control bits have no effect and all bits in the test register feetst will be cleared. this ensures that flash eeprom test mode cannot be invoked inadvertently during normal operation. note that the flash eeprom module will operate normally, even if smod is asserted, until a special test function is invoked. the test mode adds additional features over normal mode which allow the tests to be performed even after the device is installed in the final product. 7.11 flash program/erase voltage signal conditioning a voltage of at least vdd ?0.35 v must be applied at all times to the vfpe pins; or damage to the flash module can occur. flash modules can be damaged by power-on and power off vfpe transients. vfpe must not rise to programming level while vdd is below specified minimum value, and must not fall below minimum specified value while vdd is applied. figure 9 shows the vfpe and vdd operating envelope. refer to appendix a electrical characteristics for maximum and operating voltage specifications. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 47 figure 9 v fpe operation range use of an external circuit to condition vfpe is recommended. figure 19 shows a simple circuit that maintains required voltages and filters transients. vfpe is pulled up to vdd via schottky diode d2. application of programming voltage via diode d1 reverse-biases d2, protecting vdd from excessive reverse current. d2 also protects the flash from damage should programming voltage go to zero. programming power supply voltage must be adjusted to compensate for the forward- bias drop across d1. the charge time constant of r1 and c1 filters transients, while r2 provides a discharge bleed path for c1. allow for rc charge and discharge time constants when applying and removing power. when using this circuit, keep leakage from external devices connected to the vfpe pin low, to minimize diode voltage drop. 0 v ?0.30 v 4.15 v 4.5 v 6.5 v 11.4 v 12.6 v 13.5 v 30 ns maximum v fpe envelope v dd envelope t er combined v dd and v fpe power on normal read program erase verify power down f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 48 MC68HC912BL16TS/d figure 10 v fpe conditioning circui programming voltage power supply v dd 4.5v 22 k w d2 d1 10 w 0.1 m f v fpe pin r2 r1 c1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 49 8 eeprom the mc68hc912bl16 eeprom serves as a 512-byte nonvolatile memory which can be used for fre- quently accessed static data or as fast access program code. the mc68hc912bl16 eeprom is arranged in a 16-bit configuration. the eeprom array may be read as either bytes, aligned words or misaligned words. access times is one bus cycle for byte and aligned word access and two bus cycles for misaligned word operations. programming is by byte or aligned word. attempts to program or erase misaligned words will fail. only the lower byte will be latched and programmed or erased. programming and erasing of the user ee- prom can be done in all operating modes. each eeprom byte or aligned word must be erased before programming. the eeprom module sup- ports byte, aligned word, row (32 bytes) or bulk erase, all using the internal charge pump. bulk erasure of odd and even rows is also possible in test modes; the erased state is $ff. the eeprom module has hardware interlocks which protect stored data from corruption by accidentally enabling the program/ erase voltage. programming voltage is derived from the internal v dd supply with an internal charge pump. the eeprom has a minimum program/erase life of 10,000 cycles over the complete operating temperature range. 8.1 eeprom programmer? model the eeprom module consists of two separately addressable sections. the first is a four-byte memory mapped control register block used for control, testing and configuration of the eeprom array. the second section is the eeprom array itself. at reset, the four-byte register section starts at address $00f0 and the eeprom array is located from addresses $0e00 to $0fff (see figure 11 ). for information on remapping the register block and ee- prom address space, refer to 5 operating modes and resource mapping . read access to the memory array section can be enabled or disabled by the eeon control bit in the initee register. this feature allows the access of memory mapped resources that have lower priority than the eeprom memory array. eeprom control registers can be accessed and eeprom locations may be programmed or erased regardless of the state of eeon. using the normal eeprog control, it is possible to continue program/erase operations during wait. for lowest power consumption during wait, stop program/erase by turning off eepgm. if the stop mode is entered during programming or erasing, program/erase voltage will be automati- cally turned off and the rc clock (if enabled) is stopped. however, the eepgm control bit will remain set. when stop mode is terminated, the program/erase voltage will be automatically turned back on if eepgm is set. at bus frequencies below 1 mhz, the rc clock must be turned on for program/erase. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 50 MC68HC912BL16TS/d figure 11 eeprom block protect mapping 8.2 eeprom control registers nosec ?no security mode 0 = security mode will be enabled on the next reset 1 = normal operation this bit should be 1 for normal operation. please contact motorola marketing for the security mode op- eration. eeswai ?eeprom stops in wait mode 0 = module is not affected during wait mode 1 = module ceases to be clocked during wait mode this bit should be cleared if the wait mode vectors are mapped in the eeprom array. protlck ?block protect write lock 0 = block protect bits and bulk erase protection bit can be written 1 = block protect bits are locked read anytime. write once in normal modes (smodn = 1), set and clear any time in special modes (smodn = 0). eerc ?eeprom charge pump clock 0 = system clock is used as clock source for the internal charge pump. internal rc oscillator is stopped. 1 = internal rc oscillator drives the charge pump. the rc oscillator is required when the system bus clock is lower than f prog . read and write anytime. eemcr ?eeprom module configuration $00f0 bit 7 6 5 4 3 2 1 bit 0 nosec 1 1 1 1 eeswai protlck eerc reset: 1 1 1 1 1 1 0 0 reserved (64 bytes) vectors (64 bytes) single chip vectors hc912bl16 eeprom block prot $ff80 $ffbf $ffc0 $ffff bprot0 bprot1 bprot2 bprot3 $_f00 $_e00 $_f80 $_fc0 (256 bytes) (128 bytes) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 51 prevents accidental writes to eeprom. read anytime. write anytime if eepgm = 0 and protlck = 0. stprot shadow and test row protection 0 = shadow and test rows can be programmed and erased. 1 = shadow and test rows are protected from being programmed and erased. this bit cannot be modified while programming is taking place (eepgm = 1). bprot[4:0] ?eeprom block protection 0 = associated eeprom block can be programmed and erased. 1 = associated eeprom block is protected from being programmed and erased. cannot be modified while programming is taking place (eepgm = 1). read anytime. write in special modes only (smodn = 0). these bits are used for test purposes only. in normal modes the bits are forced to zero. eeodd ?odd row programming 0 = odd row bulk programming/erasing is disabled. 1 = bulk program/erase all odd rows. refers to a physical location in the array rather than an odd byte address. eeven ?even row programming 0 = even row bulk programming/erasing is disabled. 1 = bulk program/erase all even rows. refers to a physical location in the array rather than an even byte address. marg ?program and erase voltage margin test enable 0 = normal operation. 1 = program and erase margin test. this bit is used to evaluate the program/erase voltage margin. eecpd ?charge pump disable 0 = charge pump is turned on during program/erase. 1 = disable charge pump. eeprot ?eeprom block protect $00f1 bit 7 6 5 4 3 2 1 bit 0 stprot 1 1 1 bprot3 bprot2 bprot1 bprot0 reset: 1 1 1 1 1 1 1 1 table 15 512-byte eeprom block protection bit name block protected block size bprot3 $0e00 to $0eff 256 bytes bprot2 $0f00 to $0f7f 128 bytes bprot1 $0f80 to $0fbf 64 bytes bprot0 $0fc0 to $0fff 64 bytes eetst ?eeprom test $00f2 bit 7 6 5 4 3 2 1 bit 0 eeodd eeven marg eecpd eecprd 0 eecpm 0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 52 MC68HC912BL16TS/d eecprd ?charge pump ramp disable known to enhance write/erase endurance of eeprom cells. 0 = charge pump is turned on progressively during program/erase. 1 = disable charge pump controlled ramp up. eecpm ?charge pump monitor enable 0 = normal operation. 1 = output the charge pump voltage on the irq /v pp pin. bulkp ?bulk erase protection 0 = eeprom can be bulk erased. 1 = eeprom is protected from being bulk or row erased. read anytime. write anytime if eepgm = 0 and protlck = 0. byte ?byte and aligned word erase 0 = bulk or row erase is enabled. 1 = one byte or one aligned word erase only. read anytime. write anytime if eepgm = 0. row ?row or bulk erase (when byte = 0) 0 = erase entire eeprom array. 1 = erase only one 32-byte row. read anytime. write anytime if eepgm = 0. byte and row have no effect when erase = 0 if byte = 1 and test mode is not enabled, only the location specified by the address written to the pro- gramming latches will be erased. the operation will be a byte or an aligned word erase depending on the size of written data. erase ?erase control 0 = eeprom configuration for programming or reading. 1 = eeprom configuration for erasure. read anytime. write anytime if eepgm = 0. configures the eeprom for erasure or programming. when test mode is not enabled and unless bulkp is set, erasure is by byte, aligned word, row or bulk. eelat ?eeprom latch control 0 = eeprom set up for normal reads. 1 = eeprom address and data bus latches set up for programming or erasing. read anytime. write anytime if eepgm = 0. note when eelat is set, the entire eeprom is unavailable for reads, therefore, no pro- eeprog ?eeprom control $00f3 bit 7 6 5 4 3 2 1 bit 0 bulkp 0 0 byte row erase eelat eepgm reset: 1 0 0 0 0 0 0 0 table 16 erase selection byte row block size 0 0 bulk erase entire eeprom array 0 1 row erase 32 bytes 1 0 byte or aligned word erase 1 1 byte or aligned word erase f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 53 gram residing in the eeprom can be executed while attempting to program un- used eeprom space. care should be taken that no references to the eeprom are used while programming. interrupts should be turned off if the vectors are in the eeprom. timing and any serial communications must be done with polling during the programming process. byte, row, erase and eelat bits can be written simultaneously or in any sequence. eepgm ?program and erase enable 0 = disables program/erase voltage to eeprom. 1 = applies program/erase voltage to eeprom. the eepgm bit can be set only after eelat has been set. when an attempt is made to set eelat and eepgm simultaneously, eepgm remains clear but eelat is set. the bulkp, byte, row, erase and eelat bits cannot be changed when eepgm is set. to com- plete a program or erase, two successive writes to clear eepgm and eelat bits are required before reading the programmed data. a write to an eeprom location has no effect when eepgm is set. latched address and data cannot be modified during program or erase. a program or erase operation should follow the sequence below: 1. write byte, row and erase to the desired value; write eelat = 1 2. write a byte or an aligned word to an eeprom address 3. write eepgm = 1 4. wait for programming ( t prog ) or erase ( t erase ) delay time 5. write eepgm = 0 6. write eelat = 0 it is possible to program/erase more bytes or words without intermediate eeprom reads, by jumping from step 5 to step 2. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 54 MC68HC912BL16TS/d 9 resets and interrupts cpu12 exceptions include resets and interrupts. each exception has an associated 16-bit vector, which points to the memory location where the routine that handles the exception is located. vectors are stored in the upper 128 bytes of the standard 64-kbyte address map. the six highest vector addresses are used for resets and non-maskable interrupt sources. the remain- der of the vectors are used for maskable interrupts, and all must be initialized to point to the address of the appropriate service routine. 9.1 exception priority a hardware priority hierarchy determines which reset or interrupt is serviced first when simultaneous requests are made. six sources are not maskable. the remaining sources are maskable, and any one of them can be given priority over other maskable interrupts. the priorities of the non-maskable sources are: 1. por or reset pin 2. clock monitor reset 3. cop watchdog reset 4. unimplemented instruction trap 5. software interrupt instruction (swi) 6. xirq signal (if x bit in ccr = 0) 9.2 maskable interrupts maskable interrupt sources include on-chip peripheral systems and external interrupt service requests. interrupts from these sources are recognized when the global interrupt mask bit (i) in the ccr is cleared. the default state of the i bit out of reset is one, but it can be written at any time. interrupt sources are prioritized by default but any one maskable interrupt source may be assigned the highest priority by means of the hprio register. the relative priorities of the other sources remain the same. an interrupt that is assigned highest priority is still subject to global masking by the i bit in the ccr, or by any associated local bits. interrupt vectors are not affected by priority assignment. hprio can only be written while the i bit is set (interrupts inhibited). table 17 lists interrupt sources and vectors in default order of priority. table 17 interrupt vector map vector address interrupt source ccr mask local enable register (bit) hprio value to elevate $fffe, $ffff reset none none $fffc, $fffd cop clock monitor fail reset none copctl (cme, fcme) $fffa, $fffb cop failure reset none cop rate selected $fff8, $fff9 unimplemented instruction trap none none $fff6, $fff7 swi none none $fff4, $fff5 xirq x bit none $fff2, $fff3 irq i bit intcr (irqen) $f2 $fff0, $fff1 real time interrupt i bit rtictl (rtie) $f0 $ffee, $ffef timer channel 0 i bit tmsk1 (c0i) $ee $ffec, $ffed timer channel 1 i bit tmsk1 (c1i) $ec $ffea, $ffeb timer channel 2 i bit tmsk1 (c2i) $ea f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 55 9.3 interrupt control and priority registers irqe ?irq select edge sensitive only 0 = irq configured for low-level recognition. 1 = irq configured to respond only to falling edges (on pin pe1/irq ). irqe can be read anytime and written once in normal modes. in special modes, irqe can be read any- time and written anytime, except the first write is ignored. irqen ?external irq enable 0 = external irq pin disconnected from interrupt logic 1 = external irq pin connected to interrupt logic irqen can be read and written anytime in all modes. dly ?enable oscillator start-up delay on exit from stop the delay time of about 4096 cycles is based on the e clock rate. 0 = no stabilization delay imposed on exit from stop mode. a stable external oscillator must be supplied. 1 = stabilization delay is imposed before processing resumes after stop. dly can be read anytime and written once in normal modes. in special modes, dly can be read and written anytime. write only if i mask in ccr = 1 (interrupts inhibited). read anytime. $ffe8, $ffe9 timer channel 3 i bit tmsk1 (c3i) $e8 $ffe6, $ffe7 timer channel 4 i bit tmsk1 (c4i) $e6 $ffe4, $ffe5 timer channel 5 i bit tmsk1 (c5i) $e4 $ffe2, $ffe3 timer channel 6 i bit tmsk1 (c6i) $e2 $ffe0, $ffe1 timer channel 7 i bit tmsk1 (c7i) $e0 $ffde, $ffdf timer overflow i bit tmsk2 (toi) $de $ffdc, $ffdd pulse accumulator overflow i bit pactl (paovi) $dc $ffda, $ffdb pulse accumulator input edge i bit pactl (pai) $da $ffd8, $ffd9 spi serial transfer complete i bit sp0cr1 (spie) $d8 $ffd6, $ffd7 sci 0 i bit sc0cr2 (tie, tcie, rie, ilie) $d6 $ffd4, $ffd5 reserved i bit $d4 $ffd2, $ffd3 atd i bit atdctl2 (ascie) $d2 $ff80?ffcf reserved i bit $80?ce intcr ?interrupt control register $001e bit 7 6 5 4 3 2 1 bit 0 irqe irqen dly 0 0 0 0 0 reset: 0 1 1 0 0 0 0 0 hprio ?highest priority i interrupt $001f bit 7 6 5 4 3 2 1 bit 0 1 1 psel5 psel4 psel3 psel2 psel1 0 reset: 1 1 1 1 0 0 1 0 table 17 interrupt vector map vector address interrupt source ccr mask local enable register (bit) hprio value to elevate f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 56 MC68HC912BL16TS/d to give a maskable interrupt source highest priority, write the low byte of the vector address to the hprio register. for example, writing $f0 to hprio would assign highest maskable interrupt priority to the real-time interrupt timer ($fff0). if an unimplemented vector address or a non-i-masked vector ad- dress (value higher than $f2) is written, then irq will be the default highest priority interrupt. 9.4 resets there are four possible sources of reset. power-on reset (por), and external reset on the reset pin share the normal reset vector. the computer operating properly (cop) reset and the clock monitor reset each has a vector. entry into reset is asynchronous and does not require a clock but the mcu cannot sequence out of reset without a system clock. 9.4.1 power-on reset a positive transition on v dd causes a power-on reset (por). an external voltage level detector, or other external reset circuits, are the usual source of reset in a system. the por circuit only initializes internal circuitry during cold starts and cannot be used to force a reset as system voltage drops. 9.4.2 external reset the cpu distinguishes between internal and external reset conditions by sensing whether the reset pin rises to a logic one in less than eight e-clock cycles after an internal device releases reset. when a reset condition is sensed, the reset pin is driven low by an internal device for about 16 e-clock cycles, then released. eight e-clock cycles later it is sampled. if the pin is still held low, the cpu assumes that an external reset has occurred. if the pin is high, it indicates that the reset was initiated internally by either the cop system or the clock monitor. to prevent a cop or clock monitor reset from being detected during an external reset, hold the reset pin low for at least 32 cycles. an external rc power-up delay circuit on the reset pin is not recommended ?circuit charge time can cause the mcu to misinterpret the type of reset that has occurred. 9.4.3 cop reset the mcu includes a computer operating properly (cop) system to help protect against software fail- ures. when cop is enabled, software must write $55 and $aa (in this order) to the coprst register in order to keep a watchdog timer from timing out. other instructions may be executed between these writes. a write of any value other than $55 or $aa or software failing to execute the sequence properly causes a cop reset to occur. 9.4.4 clock monitor reset if clock frequency falls below a predetermined limit when the clock monitor is enabled, a reset occurs. 9.5 effects of reset when a reset occurs, mcu registers and control bits are changed to known start-up states, as follows. 9.5.1 operating mode and memory map operating mode and default memory mapping are determined by the states of the bkgd, moda, and modb pins during reset. the smodn, moda, and modb bits in the mode register reflect the status of the mode-select inputs at the rising edge of reset. operating mode and default maps can subsequent- ly be changed according to strictly defined rules. 9.5.2 clock and watchdog control logic the cop watchdog system is enabled, with the cr[2:0] bits set for the shortest duration time-out. the clock monitor is disabled. the rtif flag is cleared and automatic hardware interrupts are masked. the rate control bits are cleared, and must be initialized before the rti system is used. the dly control bit is set to specify an oscillator start-up delay upon recovery from stop mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 57 9.5.3 interrupts psel is initialized in the hprio register with the value $f2, causing the external irq pin to have the highest i-bit interrupt priority. the irq pin is configured for level-sensitive operation (for wired-or sys- tems). however, the interrupt mask bits in the cpu12 ccr are set to mask x and i related interrupt requests. 9.5.4 parallel i/o if the mcu comes out of reset in an expanded mode, port a and port b are used for the multiplexed address/data bus and port e pins are normally used to control the external bus (operation of port e pins can be affected by the pear register). if the mcu comes out of reset in a single-chip mode, all ports are configured as general-purpose high-impedance inputs. port s, port t, port p, and port ad are all configured as general-purpose inputs. 9.5.5 central processing unit after reset, the cpu fetches a vector from the appropriate address, then begins executing instructions. the stack pointer and other cpu registers are indeterminate immediately after reset. the ccr x and i interrupt mask bits are set to mask any interrupt requests. the s bit is also set to inhibit the stop instruction. 9.5.6 memory after reset, the internal register block is located at $0000?01ff, the register-following space is at $0200?03ff, and ram is at $0800?09ff. eeprom is located at $0e00?0fff. flash eeprom is located at $c000?ffff in single-chip modes and at $4000?7fff (but disabled) in expanded modes. 9.5.7 other resources the timer, serial communications interface (sci), serial peripheral interface (spi), pulse-width modula- tor (pwm), and analog-to-digital converter (atd) are off after reset. 9.6 register stacking once enabled, an interrupt request can be recognized at any time after the i bit in the ccr is cleared. when an interrupt service request is recognized, the cpu responds at the completion of the instruction being executed. interrupt latency varies according to the number of cycles required to complete the in- struction. some of the longer instructions can be interrupted and will resume normally after servicing the interrupt. when the cpu begins to service an interrupt, the instruction queue is cleared, the return address is cal- culated, and then it and the contents of the cpu registers are stacked as shown in table 18 . after the ccr is stacked, the i bit (and the x bit, if an xirq interrupt service request is pending) is set to prevent other interrupts from disrupting the interrupt service routine. the interrupt vector for the high- est priority source that was pending at the beginning of the interrupt sequence is fetched, and execution continues at the referenced location. at the end of the interrupt service routine, an rti instruction re- stores the content of all registers from information on the stack, and normal program execution re- sumes. if another interrupt is pending at the end of an interrupt service routine, the register unstacking and restacking is bypassed and the vector of the pending interrupt is fetched. table 18 stacking order on entry to interrupts memory location cpu registers sp ?2 rtn h : rtn l sp ?4 y h : y l sp ?6 x h : x l sp ?8 b : a sp ?9 ccr f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 58 MC68HC912BL16TS/d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 59 10 clock functions clock generation circuitry generates the internal and external e-clock signals as well as internal clock signals used by the cpu and on-chip peripherals. a clock monitor circuit, a computer operating properly (cop) watchdog circuit, and a periodic interrupt circuit are also incorporated into the mc68hc912bl16. 10.1 clock sources a compatible external clock signal can be applied to the extal pin or the mcu can generate a clock signal using an on-chip oscillator circuit and an external crystal or ceramic resonator. the mcu uses three types of internal clock signals derived from the primary clock signal: t clocks, e clock, and p clock. the t clocks are used by the cpu. the e and p clocks are used by the bus interfaces, bdm, spi, and atd. the p clock also drives on-chip modules such as the timer chain, sci, rti, cop, and restart-from- stop delay time. figure 12 shows clock timing relationships. figure 12 internal clock relationships 10.2 computer operating properly (cop) the cop or watchdog timer is an added check that a program is running and sequencing properly. when the cop is being used, software is responsible for keeping a free-running watchdog timer from timing out. if the watchdog timer times out it is an indication that the software is no longer being execut- ed in the intended sequence; thus a system reset is initiated. three control bits allow selection of seven cop time-out periods or cop disable. when cop is enabled, sometime during the selected period the program must write $55 and $aa (in this order) to the coprst register. if the program fails to do this the part will reset. if any value other than $55 or $aa is written to coprst, the part is reset. 10.3 real-time interrupt there is a real-time (periodic) interrupt available to the user. this interrupt will occur at one of seven selected rates. an interrupt flag and an interrupt enable bit are associated with this function. there are three bits for the rate select. 10.4 clock monitor the clock monitor circuit is based on an internal resistor-capacitor (rc) time delay. if no mcu clock edges are detected within this rc time delay, the clock monitor can optionally generate a system reset. the clock monitor function is enabled/disabled by the cme control bit in the copctl register. this time-out is based on an rc delay so that the clock monitor can operate without any mcu clocks. clock monitor time-outs are shown in table 19 . t1clk t2clk t3clk t4clk int eclk pclk hc12b32 clock relations f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 60 MC68HC912BL16TS/d 10.5 clock function registers all register addresses shown reflect the reset state. registers may be mapped to any 2-kbyte space. rtie ?real-time interrupt enable read and write anytime. 0 = interrupt requests from rti are disabled. 1 = interrupt will be requested whenever rtif is set. rswai ?rti and cop stop while in wait write once in normal modes, anytime in special modes. read anytime. 0 = allows the rti and cop to continue running in wait. 1 = disables both the rti and cop whenever the part goes into wait. rsbck ?rti and cop stop while in background debug mode write once in normal modes, anytime in special modes. read anytime. 0 = allows the rti and cop to continue running while in background mode. 1 = disables both the rti and cop whenever the part is in background mode. this is useful for emulation. rtbyp ?real-time interrupt divider chain bypass write not allowed in normal modes, anytime in special modes. read anytime. 0 = divider chain functions normally. 1 = divider chain is bypassed, allows faster testing (the divider chain is normally p divided by 2 13 , when bypassed becomes p divided by 4). rtr2, rtr1, rtr0 ?real-time interrupt rate select read and write anytime. rate select for real-time interrupt. the clock used for this module is the e clock. table 19 clock monitor time-outs supply range 5v +/- 10 % 2-20 m s 3v +/- 10 % 5-100 m s rtictl ?real-time interrupt control register $0014 bit 7 6 5 4 3 2 1 bit 0 rtie rswai rsbck 0 rtbyp rtr2 rtr1 rtr0 reset: 0 0 0 0 0 0 0 0 table 20 real-time interrupt rates rtr2 rtr1 rtr0 divide e by: time-out period e = 4.0 mhz time-out period e = 8.0 mhz 0 0 0 off off off 0 0 1 2 13 2.048 ms 1.024 ms 0 1 0 2 14 4.096 ms 2.048 ms 0 1 1 2 15 8.196 ms 4.096 ms 1 0 0 2 16 16.384 ms 8.196 ms 1 0 1 2 17 32.768 ms 16.384 ms 1 1 0 2 18 65.536 ms 32.768 ms 1 1 1 2 19 131.72 ms 65.536 ms f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 61 rtif ?real-time interrupt flag this bit is cleared automatically by a write to this register with this bit set. 0 = time-out has not yet occurred. 1 = set when the time-out period is met. cme ?clock monitor enable read and write anytime. if fcme is set, this bit has no meaning nor effect. 0 = clock monitor is disabled. slow clocks and stop instruction may be used. 1 = slow or stopped clocks (including the stop instruction) will cause a clock reset sequence. fcme ?force clock monitor enable write once in normal modes, anytime in special modes. read anytime. in normal modes, when this bit is set, the clock monitor function cannot be disabled until a reset occurs. 0 = clock monitor follows the state of the cme bit. 1 = slow or stopped clocks will cause a clock reset sequence. in order to use both stop and clock monitor, the cme bit should be cleared prior to executing a stop instruction and set after recovery from stop. if you plan on using stop always keep fcme = 0. fcm ?force clock monitor reset writes are not allowed in normal modes, anytime in special modes. read anytime. if disr is set, this bit has no effect. 0 = normal operation. 1 = force a clock monitor reset (if clock monitor is enabled). fcop ?force cop watchdog reset writes are not allowed in normal modes; can be written anytime in special modes. read anytime. if disr is set, this bit has no effect. 0 = normal operation. 1 = force a cop reset (if cop is enabled). disr ?disable resets from cop watchdog and clock monitor writes are not allowed in normal modes, anytime in special modes. read anytime. 0 = normal operation. 1 = regardless of other control bit states, cop and clock monitor will not generate a system reset. cr2, cr1, cr0 ?cop watchdog timer rate select bits the cop system is driven by a constant frequency of e/2 13 . (rtbyp in the rtictl register allows all but two stages of this divider to be bypassed for testing in special modes only.) these bits specify an additional division factor to arrive at the cop time-out rate (the clock used for this module is the e clock). write once in normal modes, anytime in special modes. read anytime. rtiflg ?real-time interrupt flag register $0015 bit 7 6 5 4 3 2 1 bit 0 rtif 0 0 0 0 0 0 0 reset: 0 0 0 0 0 0 0 0 copctl ?cop control register $0016 bit 7 6 5 4 3 2 1 bit 0 cme fcme fcm fcop disr cr2 cr1 cr0 reset: 0 0 0 0 0 0 0 1 normal reset: 0 0 0 0 1 0 0 1 special f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 62 MC68HC912BL16TS/d always reads $00. writing $55 to this address is the first step of the cop watchdog sequence. writing $aa to this address is the second step of the cop watchdog sequence. other instructions may be executed between these writes but both must be completed in the correct order prior to time-out to avoid a watchdog reset. writing anything other than $55 or $aa causes a cop reset to occur. read and write anytime. the slow clock divider is included to deliver a variable clock frequency to the mcu in wait mode. this slow clock is drived from the extali and in wait mode can be used for the system clocks. write to this register changes the slwclk frequency. the frequency divide ratio is 2 times slow reg- ister value, hence the divide range is 2 to 30, by steps of 2. when slow register = 0, the divider is bypassed. the generation of e and p clocks further divides slwclk by 2. hence, the final ratio of bus to extal frequency is programmable to 2, 4, 8, 12, 16, ..., 60, by steps of 4. table 21 cop watchdog rates (rtbyp = 0) cr2 cr1 cr0 divide e by: at e = 4.0 mhz time-out ? to +2.048 ms at e = 8.0 mhz time-out ? to +1.024 ms 0 0 0 off off off 0 0 1 2 13 2.048 ms 1.024 ms 0 1 0 2 15 8.1920 ms 4.096 ms 0 1 1 2 17 32.768 ms 16.384 ms 1 0 0 2 19 131.072 ms 65.536 ms 1 0 1 2 21 524.288 ms 262.144 ms 1 1 0 2 22 1.048 s 524.288 ms 1 1 1 2 23 2.097 s 1.048576 s coprst ?arm/reset cop timer register $0017 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 slow ?slow mode divider register $00e0 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 sldv3 sldv2 sldv1 sldv0 reset: 0 0 0 0 0 0 0 0 table 22 slow mode register divider rates sldv3 sldv2 sldv1 sldv0 divide by: (slow * 2) bus rate w/ 16mhz xtal bus rate w/ 8mhz xtal bus rate w/ 4mhz xtal 0 0 0 0 0 8 mhz 4 mhz 2 mhz 0 0 0 1 2 4 mhz 2 mhz 1 mhz 0 0 1 0 4 2 mhz 1 mhz 500 khz 0 0 1 1 6 1.3 mhz 667 khz 333 khz 0 1 0 0 8 1 mhz 500 khz 250 khz f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 63 read and write in special mode. bits 0-3 not writable. tstsmd ?test mode of slow mode divider 0 = not in test mode. 1 = test slow divider. internal divider states stored in tstout[3:0] bcss?bus clock select slow 0 = sysclk is derived from crystal clock extali. 1 = sysclk is derived from slow clock slwclk only in special mode. when tstsmd set, tstout[3:0] shows the slow mode counter. bits are not writable. 10.6 clock divider chains figure 13 , figure 14 , figure 15 , and figure 16 summarize the clock divider chains for the various pe- ripherals on the mc68hc912bl16. the ?ntwai?signal in figure 13 , or wait mode, is the only mechanism for choosing slow clocks versus normal frequency clocks in normal operating modes. 0 1 0 1 10 800 khz 400 khz 200 khz 0 1 1 0 12 667 khz 333 khz 167 khz 0 1 1 1 14 571 khz 286 khz 143 khz 1 0 0 0 16 500 khz 250 khz 125 khz 1 0 0 1 18 444 khz 222 khz 111 khz 1 0 1 0 20 400 khz 200 khz 100 khz 1 0 1 1 22 364 khz 182 khz 91 khz 1 1 0 0 24 333 khz 167 khz 84 khz 1 1 0 1 26 308 khz 154 khz 77 khz 1 1 1 0 28 286 khz 143 khz 72 khz 1 1 1 1 30 267 khz 133 khz 67 khz cgtcfg ?clock generator test register $00e1 bit 7 6 5 4 3 2 1 bit 0 tstsmd bcss 0 0 tstout3 tstout2 tstout1 tstout0 reset: 0 0 0 0 0 0 0 0 table 22 slow mode register divider rates sldv3 sldv2 sldv1 sldv0 divide by: (slow * 2) bus rate w/ 16mhz xtal bus rate w/ 8mhz xtal bus rate w/ 4mhz xtal f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 64 MC68HC912BL16TS/d figure 13 clock divider chain figure 14 clock chain for sci, rti, cop oscillator extal xtal sysclk t clock generator to cpu e and p clock generator eclk pclk to bdm, buses, spi, atd, sci, tim, rti, cop, pwm, fee, ee, ram tclks hc912bl16 clock div chain ? 2 slow mode clock slwclk intwai (wait) extali extali sc0bd modulus divider: ? 1, 2, 3, 4, 5, 6, ..., 8190, 8191 sci0 receive baud rate ((16x) sci0 transmit baud rate (1x) bits: rtr2, rtr1, rtr0 to rti bits: cr2, cr1, cr0 to cop ? 2 4 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 ? 2 ? 2 ? 2 ? 2 ? 2 ? 2 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 ? 4 ? 4 ? 4 ? 2 ? 4 ? 2 register: copctl register: rtictl hc912bl16 clock chain sci rti cop ? 2 11 ? 2 2 bit: rtbyp register: rtictl f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 65 figure 15 clock chain for tim figure 16 clock chain for spi, atd and bdm bits: pr2, pr1, pr0 pclk 1:0:0 1:0:1 1:1:0 1:1:1 to tim counter por t t7 pamod paclk pulse acc low byte paclk/256 pulse acc high byte paclk/65536 (paov) gate logic bits: paen, clk1, clk0 0:x:x ten paen 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 ? 2 ? 2 ? 2 ? 2 ? 2 ? 2 register: pactl register: tmsk2 hc12 clock chain tim pclk bits : spr2, spr1, spr0 spi bit rate 5-bit modulus counter (pr0-pr4) to atd eclk bkgd bdm bit clock: receive: detect falling edge, count 12 e clocks, sample input transmit 1: detect falling edge, count 6 e clocks while output is high impedance, drive out 1 e cycle pulse high, high imped- ance output again transmit 0: detect falling edge, drive out low, count 9 e clocks, drive out 1 e cycle pulse high, high impedance output pin synchronizer logic bkgd in bkgd out bkgd direction ? 2 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 ? 2 ? 2 ? 2 ? 2 ? 2 ? 2 ? 2 ? 2 register: sp0br hc12 clock chain spi atd bdm f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 66 MC68HC912BL16TS/d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 67 11 pulse-width modulator the pulse-width modulator (pwm) subsystem provides four independent 8-bit pwm waveforms or two 16-bit pwm waveforms or a combination of one 16-bit and two 8-bit pwm waveforms. each waveform channel has a programmable period and a programmable duty-cycle as well as a dedicated counter. a flexible clock select scheme allows four different clock sources to be used with the counters. each of the modulators can create independent, continuous waveforms with software-selectable duty rates from 0 percent to 100 percent. the pwm outputs can be programmed as left-aligned outputs or center- aligned outputs. the period and duty registers are double buffered so that if they change while the channel is enabled, the change will not take effect until the counter rolls over or the channel is disabled. if the channel is not enabled, then writes to the period and/or duty register will go directly to the latches as well as the buffer, thus ensuring that the pwm output will always be either the old waveform or the new waveform, not some variation in between. for center aligned mode two additional initialization operations occur: the pwm counter is reset to $00 and a decision for the pwm output value takes place. in this way the output of the pwm will always be; the old waveform, or the new waveform and not some variation of the two. a change in duty or period can be forced into immediate effect by writing the new value to the duty and/ or period registers and then writing to the counter. this causes the counter to reset and the new duty and/or period values to be latched. in addition, since the counter is readable it is possible to know where the count is with respect to the duty value and software can be used to make adjustments by turning the enable bit off and on. the four pwm channel outputs share general-purpose port p pins. enabling pwm pins takes prece- dence over the general-purpose port. when pwm are not in use, the port pins may be used for discrete input/output. figure 17 block diagram of pwm left-aligned output channel gate pwcntx 8-bit compare = pwdtyx 8-bit compare = pwperx up /down from port p data register to pin driver ppolx clock source (eclk) (clock edge sync) reset centr = 0 mux mux s r q q pwper pwdty pwenx ppol = 0 ppol = 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 68 MC68HC912BL16TS/d figure 18 block diagram of pwm center-aligned output channel gate pwcntx 8-bit compare = pwdtyx 8-bit compare = pwperx reset from port p data register to pin driver ppolx clock source (eclk) (clock edge sync) centr = 1 mux mux t q q pwdty pwenx ppol = 0 ppol = 1 (duty cycle) (period) pwper 2 (pwper - pwdty) 2 pwdty f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 69 figure 19 pwm clock sources 11.1 pwm register description read and write anytime. con23 ?concatenate pwm channels 2 and 3 when concatenated, channel 2 becomes the high-order byte and channel 3 becomes the low-order byte. channel 2 output pin is used as the output for this 16-bit pwm (bit 2 of port p). channel 3 clock- select control bits determines the clock source. 0 = channels 2 and 3 are separate 8-bit pwms. 1 = channels 2 and 3 are concatenated to create one 16-bit pwm channel. pwclk ? pwm clocks and concatenate $0040 bit 7 6 5 4 3 2 1 bit 0 con23 con01 pcka2 pcka1 pcka0 pckb2 pckb1 pckb0 reset: 0 0 0 0 0 0 0 0 8-bit down counter pclk2 pclk3 clock to pwm channel 2 clock to pwm channel 3 ? 2 pwscnt1 8-bit scale register pwscal1 clock b **clock s1 = (clock b)/2, (clock b)/4, (clock b)/6,... (clock b)/512 ? 2 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 ? 2 ? 2 ? 2 ? 2 ? 2 ? 2 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 8-bit down counter pclk0 pclk1 clock to pwm channel 0 clock to pwm channel 1 ? 2 pwscnt0 8-bit scale register pwscal0 clock a *clock s0 = (clock a)/2, (clock a)/4, (clock a)/6,... (clock a)/512 register: bits: pckb2, pckb0 pckb1, = 0 = 0 bits: pcka2, pcka0 pcka1, pwpres psbck limbdm eclk psbck is bit 0 of pwctl register. internal signal limbdm is one if the mcu is in background debug mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 70 MC68HC912BL16TS/d con01 ?concatenate pwm channels 0 and 1 when concatenated, channel 0 becomes the high-order byte and channel 1 becomes the low-order byte. channel 0 output pin is used as the output for this 16-bit pwm (bit 0 of port p). channel 1 clock- select control bits determine the clock source. 0 = channels 0 and 1 are separate 8-bit pwms. 1 = channels 0 and 1 are concatenated to create one 16-bit pwm channel. note these bits should be changed only when both corresponding channels are dis- abled. for left aligned output mode operation when changing these bits the user should write to the associated pwm counters as the last operation before en- abling (setting pwenx = 1) the channels(s). pcka2 ?pcka0 ?prescaler for clock a clock a is one of two clock sources which may be used for channels 0 and 1. these three bits determine the rate of clock a, as shown in table 23 . pckb2 ?pckb0 ?prescaler for clock b clock b is one of two clock sources which may be used for channels 2 and 3. these three bits determine the rate of clock b, as shown in table 23 . read and write anytime. pclk3 ?pwm channel 3 clock select 0 = clock b is the clock source for channel 3. 1 = clock s1 is the clock source for channel 3. pclk2 ?pwm channel 2 clock select 0 = clock b is the clock source for channel 2. 1 = clock s1 is the clock source for channel 2. pclk1 ?pwm channel 1 clock select 0 = clock a is the clock source for channel 1. 1 = clock s0 is the clock source for channel 1. table 23 clock a and clock b prescaler pcka2 (pckb2) pcka1 (pckb1) pcka0 (pckb0) value of clock a (b) 0 0 0 e 0 0 1 e ? 2 0 1 0 e ? 4 0 1 1 e ? 8 1 0 0 e ? 16 1 0 1 e ? 32 1 1 0 e ? 64 1 1 1 e ? 128 pwpol pwm clock select and polarity $0041 bit 7 6 5 4 3 2 1 bit 0 pclk3 pclk2 pclk1 pclk0 ppol3 ppol2 ppol1 ppol0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 71 pclk0 ?pwm channel 0 clock select 0 = clock a is the clock source for channel 0. 1 = clock s0 is the clock source for channel 0. if a clock select is changed while a pwm signal is being generated, a truncated or stretched pulse may occur during the transition. ppol3 ?pwm channel 3 polarity 0 = channel 3 output is low at the beginning of the period; high when the duty count is reached. 1 = channel 3 output is high at the beginning of the period; low when the duty count is reached. ppol2 ?pwm channel 2 polarity 0 = channel 2 output is low at the beginning of the period; high when the duty count is reached. 1 = channel 2 output is high at the beginning of the period; low when the duty count is reached. ppol1 ?pwm channel 1 polarity 0 = channel 1 output is low at the beginning of the period; high when the duty count is reached. 1 = channel 1 output is high at the beginning of the period; low when the duty count is reached. ppol0 ?pwm channel 0 polarity 0 = channel 0 output is low at the beginning of the period; high when the duty count is reached. 1 = channel 0 output is high at the beginning of the period; low when the duty count is reached. depending on the polarity bit, the duty registers may contain the count of either the high time or the low time. if the polarity bit is zero and left alignment is selected, the duty registers contain a count of the low time. if the polarity bit is one, the duty registers contain a count of the high time. note register bits pclk0 to pclk3 may be written anytime. if a clock select is changed while a pwm signal is being generated, a truncated or stretched pulse may occur during transition. note depending on the polarity bit, the duty registers may contain the count of either the high time or the low time. if the polarity bit is one, the output starts high and then goes low when the duty count is reached, so the duty registers contatin a count of the high time. if the polarity bits is zero, the output starts low and then goes high when the duty count is reached, so the duty registers contatin a count of the low time. setting any of the pwenx bits causes the associated port p line to become an output regardless of the state of the associated data direction register (ddrp) bit. this does not change the state of the data direction bit. when pwenx returns to zero, the data direction bit controls i/o direction. on the front end of the pwm channel, the scaler clock is enabled to the pwm circuit by the pwenx enable bit being high. when all four pwm channels are disabled, the prescaler counter shuts off to save power. there is an edge-synchronizing gate circuit to guarantee that the clock will only be enabled or disabled at an edge. read and write anytime. pwen3 ?pwm channel 3 enable the pulse modulated signal will be available at port p, bit 3 when its clock source begins its next cycle. 0 = channel 3 is disabled. pwen ?pwm enable $0042 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 pwen3 pwen2 pwen1 pwen0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 72 MC68HC912BL16TS/d 1 = channel 3 is enabled. pwen2 ?pwm channel 2 enable the pulse modulated signal will be available at port p, bit 2 when its clock source begins its next cycle. 0 = channel 2 is disabled. 1 = channel 2 is enabled. pwen1 ?pwm channel 1 enable the pulse modulated signal will be available at port p, bit 1 when its clock source begins its next cycle. 0 = channel 1 is disabled. 1 = channel 1 is enabled. pwen0 ?pwm channel 0 enable the pulse modulated signal will be available at port p, bit 0 when its clock source begins its next cycle. 0 = channel 0 is disabled. 1 = channel 0 is enabled. pwpres is a free-running 7-bit counter. read anytime. write only in special mode (smod = 1). read and write anytime. a write will cause the scaler counter pwscnt0 to load the pwscal0 value unless in special mode with discal = 1 in the pwtst register. pwm channels 0 and 1 can select clock s0 (scaled) as its input clock by setting the control bit pclk0 and pclk1 respectively. clock s0 is generated by dividing clock a by the value in the pwscal0 reg- ister plus one and dividing again by two. when pwscal0 = $ff, clock a is divided by 256 then divided by two to generate clock s0. pwscnt0 is a down-counter that, upon reaching $00, loads the value of pwscal0. read any time. read and write anytime. a write will cause the scaler counter pwscnt1 to load the pwscal1 value unless in special mode with discal = 1 in the pwtst register. pwm channels 2 and 3 can select clock s1 (scaled) as its input clock by setting the control bit pclk2 and pclk3 respectively. clock s1 is generated by dividing clock b by the value in the pwscal1 reg- ister plus one and dividing again by two. when pwscal1 = $ff, clock b is divided by 256 then divided pwpres pwm prescale counter $0043 bit 7 6 5 4 3 2 1 bit 0 0 bit 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 pwscal0 pwm scale register 0 $0044 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 pwscnt0 ? pwm scale counter 0 value $0045 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 pwscal1 pwm scale register 1 $0046 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 73 by two to generate clock s1. pwscnt1 is a down-counter that, upon reaching $00, loads the value of pwscal1. read any time. read and write anytime. a write will cause the pwm counter to reset to $00. in special mode, if discr = 1, a write does not reset the pwm counter. each counter may be read any time without affecting the count or the operation of the corresponding pwm channel. writes to a counter cause the counter to be reset to $00 and force an immediate load of both duty and period registers with new values. to avoid a truncated pwm period, write to a counter while the counter is disabled. in left-aligned output mode, resetting the counter and starting the wave- form output is controlled by a match between the period register and the value in the counter. in center- aligned output mode the counters operate as up/down counters, where a match in period changes the counter direction. the duty register changes the state of the output during the period to determine the duty. when a channel is enabled, the associated pwm counter starts at the count in the pwcntx register using the clock selected for that channel. in special mode, when discp = 1 and configured for left-aligned output, a match of period does not reset the associated pwm counter. read and write anytime. the value in the period register determines the period of the associated pwm channel. if written while the channel is enabled, the new value will not take effect until the existing period terminates, forcing the counter to reset. the new period is then latched and is used until a new period value is written. reading this register returns the most recent value written. to start a new period immediately, write the new pe- riod value and then write the counter forcing a new period to start with the new period value. period = channel-clock-period (pwper + 1) (centr = 0) period = channel-clock-period pwper 2 (centr = 1) pwscnt1 ? pwm scale counter 1 value $0047 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 pwcntx ?pwm channel counters bit 7 6 5 4 3 2 1 bit 0 pwcnt0 bit 7 6 5 4 3 2 1 bit 0 $0048 pwcnt1 bit 7 6 5 4 3 2 1 bit 0 $0049 pwcnt2 bit 7 6 5 4 3 2 1 bit 0 $004a pwcnt3 bit 7 6 5 4 3 2 1 bit 0 $004b reset: 0 0 0 0 0 0 0 0 pwperx ?pwm channel period registers bit 7 6 5 4 3 2 1 bit 0 pwper0 bit 7 6 5 4 3 2 1 bit 0 $004c pwper1 bit 7 6 5 4 3 2 1 bit 0 $004d pwper2 bit 7 6 5 4 3 2 1 bit 0 $004e pwper3 bit 7 6 5 4 3 2 1 bit 0 $004f reset: 1 1 1 1 1 1 1 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 74 MC68HC912BL16TS/d read and write anytime. the value in each duty register determines the duty of the associated pwm channel. when the duty value is equal to the counter value, the output changes state. if the register is written while the channel is enabled, the new value is held in a buffer until the counter rolls over or the channel is disabled. read- ing this register returns the most recent value written. if the duty register is greater than or equal to the value in the period register, there will be no duty change in state. if the duty register is set to $ff the output will always be in the state which would normally be the state opposite the ppolx value. left-aligned-output mode (centr = 0): duty cycle = [(pwdtyx + 1) / (pwperx + 1)] 100% (ppolx = 1) duty cycle = [(pwperx - pwdtyx) / (pwperx + 1)] 100% (ppolx = 0) center-aligned-output mode (centr = 1): duty cycle = [(pwperx - pwdtyx) / pwperx] 100% (ppolx = 0) duty cycle = (pwdtyx / pwperx) 100% (ppolx = 1) read and write anytime. pswai ?pwm halts while in wait mode 0 = allows pwm main clock generator to continue while in wait mode. 1 = halt pwm main clock generator when the part is in wait mode. centr ?center-aligned output mode to avoid irregularities in the pwm output mode, write the centr bit only when pwm channels are dis- abled. 0 = pwm channels operate in left-aligned output mode 1 = pwm channels operate in center-aligned output mode rdp ?reduced drive of port p 0 = all port p output pins have normal drive capability. 1 = all port p output pins have reduced drive capability. pupp ?pull-up port p enable 0 = all port p pins have an active pull-up device disabled. 1 = all port p pins have an active pull-up device enabled. pwdtyx ?pwm channel duty registers bit 7 6 5 4 3 2 1 bit 0 pwdty0 bit 7 6 5 4 3 2 1 bit 0 $0050 pwdty1 bit 7 6 5 4 3 2 1 bit 0 $0051 pwdty2 bit 7 6 5 4 3 2 1 bit 0 $0052 pwdty3 bit 7 6 5 4 3 2 1 bit 0 $0053 reset: 1 1 1 1 1 1 1 1 pwctl pwm control register $0054 bit 7 6 5 4 3 2 1 bit 0 0 0 0 pswai centr rdp pupp psbck reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 75 psbck ?pwm stops while in background mode 0 = allows pwm to continue while in background mode. 1 = disable pwm input clock when the part is in background mode. read anytime but write only in special mode (smodn = 0). these bits are available only in special mode and are reset in normal mode. the pwm has some special test functions which are only accessible when the device is in special mode. special mode is indicated to the pwm module when the smod line on the lib is asserted. when the smod line is asserted, the special mode register control bits are accessed via the lib. when smod is not asserted, writes to the special mode control bits have no effect and all bits in the special mode register are forced to 0. this ensures that the pwm special mode can not be invoked inadvert- ently during normal operation. discr ?disable reset of channel counter on write to channel counter 0 = normal operation. write to pwm channel counter will reset channel counter. 1 = write to pwm channel counter does not reset channel counter. discp ?disable compare count period 0 = normal operation 1 = in left-aligned output mode, match of the period does not reset the associated pwm counter register. discal ?disable load of scale-counters on write to the associated scale registers 0 = normal operation 1 = write to pwscal0 and pwscal1 does not load scale counters pwm functions share port p pins 3 to 0 and take precedence over the general-purpose port when en- abled. portp can be read anytime. when configured as input, a read will return the pin level. when configured as output, a read will return the latched output data. a write will drive associated pins only if configured for output and the corresponding pwm channel is not enabled. after reset, all pins are general-purpose, high-impedance inputs. note writes do not change pin state when pin is configured for pwm outputs, only after the pwm channel becomes available on port p pin, see pwen bit description. pwtst pwm special mode register (?est? $0055 bit 7 6 5 4 3 2 1 bit 0 discr discp discal 0 0 0 0 0 reset: 0 0 0 0 0 0 0 0 portpp port p data register $0056 bit 7 6 5 4 3 2 1 bit 0 pp7 pp6 pp5 pp4 pp3 pp2 pp1 pp0 pwm pwm3 pwm2 pwm1 pwm0 reset: portpd ? port p data direction register $0057 bit 7 6 5 4 3 2 1 bit 0 ddp7 ddp6 ddp5 ddp4 ddp3 ddp2 ddp1 ddp0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 76 MC68HC912BL16TS/d this register determines pin direction of port p when used for general-purpose i/o. when cleared, i/o pin is configured for input. when set, i/o pin is configured for output. read and write anytime. ddrp[7:0] ?ata direction port p pins 0 = configure i/o pin for input only 1 = configure i/o for output 11.2 pwm boundary cases the boundary conditions for the pwm channel duty registers and the pwm channel period registers cause these results: table 24 pwm boundary conditions pwdtyx pwperx ppolx output $ff > $00 1 low $ff > $00 0 high 3 pwperx 1 high 3 pwperx 0 low $00 1 high $00 0 low f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 77 12 standard timer module the standard timer module consists of a 16-bit software-programmable counter driven by a prescaler. it contains seven complete 16-bit input capture/output compare channels and one 16-bit pulse accumu- lator. (port t[6] is not bonded to any pin in mc68hc912bl16.) this timer can be used for many purposes, including input waveform measurements while simulta- neously generating an output waveform. pulse widths can vary from less than a microsecond to many seconds. it can also generate pwm signals without cpu intervention. figure 20 timer block diagram: input capture, output compare, pulse accumulator tff pad int oc7 pad int mux pamod pulse accumulator control registers ? 64 tc7 pin logic module clock 16-bit counter buffer latch tc7 input pin polarity ctl gate clock ctl timpt pin logic function, direction, and polarity ctl control registers prescaler divide ctl tctl1 & tctl2 input capture/ output compare register 16-bit comparator oc output ic input buffer latch - tioc tcre (counter reset) tcnt reset tcnt 16-bit counter prescaler pr2, pr1, pr0 timer count register module clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 78 MC68HC912BL16TS/d 12.1 timer registers input/output pins default to general-purpose i/o lines until an internal function which uses that pin is specifically enabled. the timer overrides the state of the ddr to force the i/o state of each associated port line when an output compare using a port line is enabled. in these cases the data direction bits will have no affect on these lines. when a pin is assigned to output an on-chip peripheral function, writing to this porttn bit does not affect the pin but the data is stored in an internal latch such that if the pin becomes available for general- purpose output the driven level will be the last value written to the porttn bit. read or write anytime. note port t[6] is not bonded to any pin in mc68hc912bl16. ios[7:0] ?input capture or output compare channel configuration 0 = the corresponding channel acts as an input capture 1 = the corresponding channel acts as an output compare. read anytime but will always return $00 (1 state is transient). write anytime. note port t[6] is not bonded out to any pin in mc68hc912bl16. foc[7:0] ?force output compare action for channel 7-0 a write to this register with the corresponding data bit(s) set causes the action which is programmed for output compare ??to occur immediately. the action taken is the same as if a successful comparison had just taken place with the tcn register except the interrupt flag does not get set. read or write anytime. note port t[6] is not bonded to any pin in mc68hc912bl16. the bits of oc7m correspond bit-for-bit with the bits of timer port (portt). setting the oc7mn will set the corresponding port to be an output port regardless of the state of the ddrtn bit when the corre- sponding tiosn bit is set to be an output compare. this does not change the state of the ddrt bits. tios ?timer input capture/output compare select $0080 bit 7 6 5 4 3 2 1 bit 0 ios7 ios6 ios5 ios4 ios3 ios2 ios1 ios0 reset: 0 0 0 0 0 0 0 0 cforc ?timer compare force register $0081 bit 7 6 5 4 3 2 1 bit 0 foc7 foc6 foc5 foc4 foc3 foc2 foc1 foc0 reset: 0 0 0 0 0 0 0 0 oc7m ?output compare 7 mask register $0082 bit 7 6 5 4 3 2 1 bit 0 oc7m7 oc7m6 oc7m5 oc7m4 oc7m3 oc7m2 oc7m1 oc7m0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 79 read or write anytime. note port t[6] is not bonded to any pin in mc68hc912bl16. the bits of oc7d correspond bit-for-bit with the bits of timer port (portt). when a successful oc7 compare occurs, for each bit that is set in oc7m, the corresponding data bit in oc7d is stored to the corresponding bit of the timer port. when the oc7mn bit is set, a successful oc7 action will override a successful oc[6:0] compare action during the same cycle; therefore, the ocn action taken will depend on the corresponding oc7d bit. a full access for the counter register should take place in one clock cycle. a separate read/write for high byte and low byte will give a different result than accessing them as a word. read anytime. write has no meaning or effect in the normal mode; only writable in special modes (smodn = 0). the period of the first count after a write to the tcnt registers may be a different size because the write is not synchronized with the prescaler clock. read or write anytime. ten ?timer enable 0 = disables the timer, including the counter. can be used for reducing power consumption. 1 = allows the timer to function normally. if for any reason the timer is not active, there is no ? 64 clock for the pulse accumulator since the e ? 64 is generated by the timer prescaler. tswai ?timer stops while in wait 0 = allows the timer to continue running during wait. 1 = disables the timer when the mcu is in the wait mode. timer interrupts cannot be used to get the mcu out of wait. tsbck ?timer stops while in background mode 0 = allows the timer to continue running while in background mode. 1 = disables the timer whenever the mcu is in background mode. this is useful for emulation. tffca ?timer fast flag clear all 0 = allows the timer flag clearing to function normally. oc7d ?output compare 7 data register $0083 bit 7 6 5 4 3 2 1 bit 0 oc7d7 oc7d6 oc7d5 oc7d4 oc7d3 oc7d2 oc7d1 oc7d0 reset: 0 0 0 0 0 0 0 0 tcnt ?timer count register $0084?0085 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 tscr ?timer system control register $0086 bit 7 6 5 4 3 2 1 bit 0 ten tswai tsbck tffca 0 0 0 0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 80 MC68HC912BL16TS/d 1 = for tflg1($8e), a read from an input capture or a write to the output compare channel ($90 $9f) causes the corresponding channel flag, cnf, to be cleared. for tflg2 ($8f), any access to the tcnt register ($84, $85) clears the tof flag. any access to the pacnt register ($a2, $a3) clears the paovf and paif flags in the paflg register ($a1). this has the advantage of eliminating software overhead in a separate clear sequence. extra care is required to avoid ac- cidental flag clearing due to unintended accesses. read or write anytime. note port t[6] is not bonded to any pin in mc68hc912bl16. omn ?output mode oln ?output level these eight pairs of control bits are encoded to specify the output action to be taken as a result of a successful ocn compare. when either omn or oln is one, the pin associated with ocn becomes an output tied to ocn regardless of the state of the associated ddrt bit. tqcr ?reserved $0087 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 0 0 reset: 0 0 0 0 0 0 0 0 tctl1 ?timer control register 1 $0088 bit 7 6 5 4 3 2 1 bit 0 om7 ol7 om6 ol6 om5 ol5 om4 ol4 reset: 0 0 0 0 0 0 0 0 tctl2 ?timer control register 2 $0089 bit 7 6 5 4 3 2 1 bit 0 om3 ol3 om2 ol2 om1 ol1 om0 ol0 reset: 0 0 0 0 0 0 0 0 table 25 compare result output action omn oln action 0 0 timer disconnected from output pin logic 0 1 toggle ocn output line 1 0 clear ocn output line to zero 1 1 set ocn output line to one tctl3 ?timer control register 3 $008a bit 7 6 5 4 3 2 1 bit 0 edg7b edg7a edg6b edg6a edg5b edg5a edg4b edg4a reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 81 read or write anytime. note port t[6] is not bonded to any pin in mc68hc912bl16. edgnb, edgna ?input capture edge control these eight pairs of control bits configure the input capture edge detector circuits. the bits in tmsk1 correspond bit-for-bit with the bits in the tflg1 status register. if cleared, the cor- responding flag is disabled from causing a hardware interrupt. if set, the corresponding flag is enabled to cause a hardware interrupt. read or write anytime. note port t[6] is not bonded to any pin in mc68hc912bl16. c7i?0i ?input capture/output compare ??interrupt enable. read or write anytime. toi ?timer overflow interrupt enable 0 = interrupt inhibited 1 = hardware interrupt requested when tof flag set pupt ?timer pull-up resistor enable this enable bit controls pull-up resistors on the timer port pins when the pins are configured as inputs. 1 = enable pull-up resistor function 0 = disable pull-up resistor function rdpt ?timer drive reduction this bit reduces the effective output driver size which can reduce power supply current and generated noise depending upon pin loading. tctl4 ?timer control register 4 $008b bit 7 6 5 4 3 2 1 bit 0 edg3b edg3a edg2b edg2a edg1b edg1a edg0b edg0a reset: 0 0 0 0 0 0 0 0 table 26 edge detector circuit configuration edgnb edgna configuration 0 0 capture disabled 0 1 capture on rising edges only 1 0 capture on falling edges only 1 1 capture on any edge (rising or falling) tmsk1 ?timer interrupt mask 1 $008c bit 7 6 5 4 3 2 1 bit 0 c7i c6i c5i c4i c3i c2i c1i c0i reset: 0 0 0 0 0 0 0 0 tmsk2 ?timer interrupt mask 2 $008d bit 7 6 5 4 3 2 1 bit 0 toi 0 pupt rdpt tcre pr2 pr1 pr0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 82 MC68HC912BL16TS/d 1 = enable output drive reduction function 0 = normal output drive capability tcre ?timer counter reset enable this bit allows the timer counter to be reset by a successful output compare 7 event. 0 = counter reset inhibited and counter free runs 1 = counter reset by a successful output compare 7 if tc7 = $0000 and tcre = 1, tcnt will stay at $0000 continuously. if tc7 = $ffff and tcre = 1, tof will never get set even though tcnt will count from $0000 through $ffff. pr2, pr1, pr0 ?timer prescaler select these three bits specify the number of ? 2 stages that are to be inserted between the module clock and the timer counter. the newly selected prescale factor will not take effect until the next synchronized edge where all pres- cale counter stages equal zero. tflg1 indicates when interrupt conditions have occurred. to clear a bit in the flag register, write a one to the bit. read anytime. write used in the clearing mechanism (set bits cause corresponding bits to be cleared). writing a zero will not affect current status of the bit. when tffca bit in tscr register is set, a read from an input capture or a write into an output compare channel ($90?9f) will cause the corresponding channel flag cnf to be cleared. c7f?0f ?input capture/output compare channel ??flag. tflg2 indicates when interrupt conditions have occurred. to clear a bit in the flag register, set the bit to one. read anytime. write used in clearing mechanism (set bits cause corresponding bits to be cleared). any access to tcnt will clear tflg2 register if the tffca bit in tscr register is set. tof ?timer overflow flag set when 16-bit free-running timer overflows from $ffff to $0000. this bit is cleared automatically by table 27 prescaler selection pr2 pr1 pr0 prescale factor 0 0 0 1 0 0 1 2 0 1 0 4 0 1 1 8 1 0 0 16 1 0 1 32 1 1 0 reserved 1 1 1 reserved tflg1 timer interrupt flag 1 $008e bit 7 6 5 4 3 2 1 bit 0 c7f c6f c5f c4f c3f c2f c1f c0f reset: 0 0 0 0 0 0 0 0 tflg2 ?timer interrupt flag 2 $008f bit 7 6 5 4 3 2 1 bit 0 tof 0 0 0 0 0 0 0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 83 a write to the tflg2 register with bit 7 set. (see also tcre control bit explanation.) tc0 ?timer input capture/output compare register 0 $0090?0091 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc1 ?timer input capture/output compare register 1 $0092?0093 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc2 ?timer input capture/output compare register 2 $0094?0095 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc3 ?timer input capture/output compare register 3 $0096?0097 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc4 ?timer input capture/output compare register 4 $0098?0099 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc5 ?timer input capture/output compare register 5 $009a?009b bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc6 ?timer input capture/output compare register 6 $009c?009d bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 84 MC68HC912BL16TS/d depending on the tios bit for the corresponding channel, these registers are used to latch the value of the free-running counter when a defined transition is sensed by the corresponding input capture edge detector or to trigger an output action for output compare. read anytime. write anytime for output compare function. writes to these registers have no meaning or effect during input capture. all timer input capture/output compare registers are reset to $0000. note port t[6] is not bonded to any pin in mc68hc912bl16. read or write anytime. paen ?pulse accumulator system enable 0 = pulse accumulator system disabled 1 = pulse accumulator system enabled paen is independent from ten. pamod ?pulse accumulator mode 0 = event counter mode 1 = gated time accumulation mode pedge ?pulse accumulator edge control for pamod = 0 (event counter mode) 0 = falling edges on the pulse accumulator input pin (pt7/pai) cause the count to be incremented 1 = rising edges on the pulse accumulator input pin cause the count to be incremented for pamod = 1 (gated time accumulation mode) 0 = pulse accumulator input pin high enables e ? 64 clock to pulse accumulator and the trailing fall- ing edge on the pulse accumulator input pin sets the paif flag. 1 = pulse accumulator input pin low enables e ? 64 clock to pulse accumulator and the trailing rising edge on the pulse accumulator input pin sets the paif flag. if the timer is not active (ten = 0 in tscr), there is no ? 64 clock since the e ? 64 clock is generated by the timer prescaler. clk1, clk0 ?clock select register tc7 ?timer input capture/output compare register 7 $009e?009f bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 pactl ?pulse accumulator control register $00a0 bit 7 6 5 4 3 2 1 bit 0 0 paen pamod pedge clk1 clk0 paovi pai reset: 0 0 0 0 0 0 0 0 table 28 clock selection clk1 clk0 selected clock 0 0 use timer prescaler clock as timer counter clock 0 1 use paclk as input to timer counter clock 1 0 use paclk/256 as timer counter clock frequency 1 1 use paclk/65536 as timer counter clock frequency f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 85 if the pulse accumulator is disabled (paen = 0), the prescaler clock from the timer is always used as an input clock to the timer counter. the change from one selected clock to the other happens immedi- ately after these bits are written. paovi ?pulse accumulator overflow interrupt enable 0 = interrupt inhibited 1 = interrupt requested if paovf is set pai ?pulse accumulator input interrupt enable 0 = interrupt inhibited 1 = interrupt requested if paif is set read or write anytime. when tffca bit in the tscr register is set, any access to the pacnt register will clear all the flags in the paflg register. paovf ?pulse accumulator overflow flag set when the 16-bit pulse accumulator overflows from $ffff to $0000. this bit is cleared automatically by a write to the paflg register with bit 1 set. paif ?pulse accumulator input edge flag set when the selected edge is detected at the pulse accumulator input pin. in event mode, the event edge triggers paif. in gated time accumulation mode, the trailing edge of the gate signal at the pulse accumulator input pin triggers paif. this bit is cleared automatically by a write to the paflg register with bit 0 set. full count register access should take place in one clock cycle. a separate read/write for high byte and low byte will give a different result than accessing them as a word. read or write anytime. read anytime. write only in special mode (smodn = 0) tcbyp ?timer divider chain bypass 0 = normal operation 1 = the 16-bit free-running timer counter is divided into two 8-bit halves and the prescaler is by- passed. the clock drives both halves directly. pcbyp ?pulse accumulator divider chain bypass paflg ?pulse accumulator flag register $00a1 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 paovf paif reset: 0 0 0 0 0 0 0 0 pacnt ?16-bit pulse accumulator count register $00a2?00a3 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 timtst ?timer test register $00ad bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 tcbyp pcbyp reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 86 MC68HC912BL16TS/d 0 = normal operation 1 = the 16-bit pulse accumulator counter is divided into two 8-bit halves and the prescaler is by- passed. the clock drives both halves directly. portt can be read anytime. when configured as an input, a read will return the pin level. when con- figured as output, a read will return the latched output data. note writes do not change pin state when the pin is configured for timer output. the minimum pulse width for pulse accumulator input should always be greater than two module clocks due to input synchronizer circuitry. the minimum pulse width for the input capture should always be greater than the width of two module clocks due to input synchronizer circuitry. port t[6] is not bonded to any pin in mc68hc912bl16. read or write anytime. 0 = configures the corresponding i/o pin for input only 1 = configures the corresponding i/o pin for output the timer forces the i/o state to be an output for each timer port pin associated with an enabled output compare. in these cases the data direction bits will not be changed but have no affect on the direction of these pins. the ddrt will revert to controlling the i/o direction of a pin when the associated timer output compare is disabled. input captures do not override the ddrt settings. 12.2 timer operation in modes stop: timer is off since both pclk and eclk are stopped. bdm: timer keeps running, unless tsbck = 1 wait: counters keep running, unless tswai = 1 normal: timer keeps running, unless ten = 0 ten = 0: all timer operations are stopped, registers may be accessed. gated pulse accumulator ? 64 clock is also disabled. paen = 0: all pulse accumulator operations are stopped, registers may be accessed. portt ?timer port data register $00ae bit 7 6 5 4 3 2 1 bit 0 pt7 pt6 pt5 pt4 pt3 pt2 pt1 pt0 timer i/oc7 i/oc6 i/oc5 i/oc4 i/oc3 i/oc2 i/oc1 i/oc0 pa pai ddrt ?data direction register for timer port $00af bit 7 6 5 4 3 2 1 bit 0 ddt7 ddt6 ddt5 ddt4 ddt3 ddt2 ddt1 ddt0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 87 13 serial interface the serial interface of the mc68hc912bl16 consists of two independent serial i/o sub-systems: the serial communication interface (sci) and the serial peripheral interface (spi). each serial pin shares function with the general-purpose port pins of port s. the sci is an nrz type system that is compatible with standard rs-232 systems. the sci system has a single wire operation mode which allows the un- used pin to be available as general-purpose i/o. the spi subsystem, which is compatible with the m68hc11 spi, includes new features such as ss output and bidirectional mode. 13.1 block diagram figure 21 serial interface block diagram 13.2 serial communication interface (sci) the serial communication interface on the mc68hc912bl16 is an nrz format (one start, eight or nine data, and one stop bit) asynchronous communication system with independent internal baud rate gen- eration circuitry and an sci transmitter and receiver. it can be configured for eight or nine data bits (one of which may be designated as a parity bit, odd or even). if enabled, parity is generated in hardware for transmitted and received data. receiver parity errors are flagged in hardware. the baud rate generator is based on a modulus counter, allowing flexibility in choosing baud rates. there is a receiver wake-up feature, an idle line detect feature, a loop-back mode, and various error detection features. two port pins provide the external interface for the transmitted data (txd) and the received data (rxd). sci spi serial hc12bl16 si block interface ps0 ps1 ps4 ps5 ps6 ps7 rxd txd miso/siso mosi/momi sck cs /ss f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 88 MC68HC912BL16TS/d figure 22 serial communications interface block diagram 13.2.1 data format the serial data format requires the following conditions: ?an idle-line in the high state before transmission or reception of a message. ?a start bit (logic zero), transmitted or received, that indicates the start of each character. ?data that is transmitted or received least significant bit (lsb) first. ?a stop bit (logic one), used to indicate the end of a frame. (a frame consists of a start bit, a char- acter of eight or nine data bits and a stop bit.) ?a break is defined as the transmission or reception of a logic zero for one frame or more. ?this sci supports hardware parity for transmit and receive. rx baud rate tx baud rate mclk divider 10-11 bit shift reg msb txd buffer/sc0drl txmtr control sc0cr2/sci ctl 2 sc0cr1/sci ctl 1 sc0sr1/int status data recovery 10-11 bit shift reg rxd buffer/sc0drl sc0bd/select lsb rxd txd wake-up logic sc0cr1/sci ctl 1 sc0sr1/int status sc0cr2/sci ctl 2 int request logic msb lsb int request logic sci receiver sci transmitter data bus parity detect parity generator hc12b32 sci block to internal logic baud rate clock ps0 ps1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 89 13.2.2 sci baud rate generation the basis of the sci baud rate generator is a 13-bit modulus counter. this counter gives the generator the flexibility necessary to achieve a reasonable level of independence from the cpu operating frequen- cy and still be able to produce standard baud rates with a minimal amount of error. the clock source for the generator comes from the p clock. 13.2.3 register descriptions control and data registers for the sci subsystem are described below. the memory address indicated for each register is the default address that is in use after reset. the entire 512-byte register block can be mapped to any 2-kbyte boundary within the standard 64-kbyte address space. sc0bdh and sc0bdl are considered together as a 16-bit baud rate control register. read any time. write sbr[12:0] anytime. low order byte must be written for change to take effect. write sbr[15:13] only in special modes. the value in sbr[12:0] determines the baud rate of the sci. the desired baud rate is determined by the following formula: which is equivalent to: br is the value written to bits sbr[12:0] to establish baud rate. note the baud rate generator is disabled until the te or re bit in sc0cr2 register is set for the first time after reset, and/or the baud rate generator is disabled when sbr[12:0] = 0. table 29 baud rate generation desired sci baud rate br divisor for p = 4.0 mhz br divisor for p = 8.0 mhz 110 2273 4545 300 833 1667 600 417 833 1200 208 417 2400 104 208 4800 52 104 9600 26 52 14400 17 35 19200 13 26 38400 13 sc0bdh ?sci baud rate control register $00c0 bit 7 6 5 4 3 2 1 bit 0 btst bspl brld sbr12 sbr11 sbr10 sbr9 sbr8 high reset: 0 0 0 0 0 0 0 0 sc0bdl ?sci baud rate control register $00c1 bit 7 6 5 4 3 2 1 bit 0 sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 low reset: 0 0 0 0 0 1 0 0 sci baud rate mclk 16 br -------------------- - = br mclk 16 sci baud rate ---------------------------------------------------- - = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 90 MC68HC912BL16TS/d btst ?baud register test reserved for test function bspl ?baud rate counter split reserved for test function brld ?baud rate reload reserved for test function read or write anytime. loops ?sci loop mode/single wire mode enable 0 = sci transmit and receive sections operate normally. 1 = sci receive section is disconnected from the rxd pin and the rxd pin is available as general purpose i/o. the receiver input is determined by the rsrc bit. the transmitter output is con- trolled by the associated ddrs bit. both the transmitter and the receiver must be enabled to use the loop or the single wire mode. if the ddrs bit associated with the txd pin is set during the loops = 1, the txd pin outputs the sci waveform. if the ddrs bit associated with the txd pin is clear during the loops = 1, the txd pin be- comes high (idle line state) for rsrc = 0 and high impedance for rsrc = 1. refer to table 30 . woms ?wired-or mode for serial pins this bit controls the two pins (txd and rxd) associated with the sci section. 0 = pins operate in a normal mode with both high and low drive capability. to affect the rxd bit, that bit would have to be configured as an output (via ddrs) which is the single wire case when using the sci. woms bit still affects general-purpose output on txd and rxd pins when sci is not using these pins. 1 = each pin operates in an open drain fashion if that pin is declared as an output . rsrc ?receiver source when loops = 1, the rsrc bit determines the internal feedback path for the receiver. 0 = receiver input is connected to the transmitter internally (not txd pin) 1 = receiver input is connected to the txd pin m ?mode (select character format) 0 = one start, eight data, one stop bit 1 = one start, eight data, ninth data, one stop bit sc0cr1 ?sci control register 1 $00c2 bit 7 6 5 4 3 2 1 bit 0 loops woms rsrc m wake ilt pe pt reset: 0 0 0 0 0 0 0 0 table 30 loop mode functions loops rsrc dds1 woms function of port s bit 1 0 x x x normal operations 1 0 0 0/1 loop mode without txd output (txd = high impedance) 1 0 1 0 loop mode with txd output (cmos) 1 0 1 1 loop mode with txd output (open-drain) 1 1 0 x single wire mode without txd output (the pin is used as receiver input only, txd = high impedance) 1 1 1 0 single wire mode with txd output (the output is also fed back to receiver input, cmos) 1 1 1 1 single wire mode for the receiving and transmitting (open-drain) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 91 wake ?wakeup by address mark/idle 0 = wake up by idle line recognition 1 = wake up by address mark (last data bit set) ilt ?idle line type determines which of two types of idle line detection will be used by the sci receiver. 0 = short idle line mode is enabled. 1 = long idle line mode is detected. in the short mode, the sci circuitry begins counting ones in the search for the idle line condition imme- diately after the start bit. this means that the stop bit and any bits that were ones before the stop bit could be counted in that string of ones, resulting in earlier recognition of an idle line. in the long mode, the sci circuitry does not begin counting ones in the search for the idle line condition until a stop bit is received. therefore, the last byte? stop bit and preceding ??bits do not affect how quickly an idle line condition can be detected. pe ?parity enable 0 = parity is disabled. 1 = parity is enabled. pt ?parity type if parity is enabled, this bit determines even or odd parity for both the receiver and the transmitter. 0 = even parity is selected. an even number of ones in the data character causes the parity bit to be zero and an odd number of ones causes the parity bit to be one. 1 = odd parity is selected. an odd number of ones in the data character causes the parity bit to be zero and an even number of ones causes the parity bit to be one. read or write anytime. tie ?transmit interrupt enable 0 = tdre interrupts disabled 1 = sci interrupt will be requested whenever the tdre status flag is set. tcie ?transmit complete interrupt enable 0 = tc interrupts disabled 1 = sci interrupt will be requested whenever the tc status flag is set. rie ?receiver interrupt enable 0 = rdrf and or interrupts disabled 1 = sci interrupt will be requested whenever the rdrf status flag or the or status flag is set. ilie ?idle line interrupt enable 0 = idle interrupts disabled 1 = sci interrupt will be requested whenever the idle status flag is set. te ?transmitter enable 0 = transmitter disabled 1 = sci transmit logic is enabled and the txd pin (port s bit 1) is dedicated to the transmitter. the te bit can be used to queue an idle preamble. re ?receiver enable 0 = receiver disabled 1 = enables the sci receive circuitry sc0cr2 ?sci control register 2 $00c3 bit 7 6 5 4 3 2 1 bit 0 tie tcie rie ilie te re rwu sbk reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 92 MC68HC912BL16TS/d rwu ?receiver wake-up control 0 = normal sci receiver 1 = enables the wake-up function and inhibits further receiver interrupts. normally hardware wakes the receiver by automatically clearing this bit. sbk ?send break 0 = break generator off 1 = generate a break code (at least 10 or 11 contiguous zeros) as long as sbk remains set the transmitter will send zeros. when sbk is changed to zero, the current frame of all zeros is finished before the txd line goes to the idle state. if sbk is toggled on and off, the transmitter will send 10 (or 11) zeros and then revert to mark idle or sending data. the bits in these registers are set by various conditions in the sci hardware and are automatically cleared by special acknowledge sequences. the receive related flag bits in sc0sr1 (rdrf, idle, or, nf, fe, and pf) are all cleared by a read of the sc0sr1 register followed by a read of the transmit/ receive data register l. however, only those bits which were set when sc0sr1 was read will be cleared by the subsequent read of the transmit/receive data register l. the transmit related bits in sc0sr1 (tdre and tc) are cleared by a read of the sc0sr1 register followed by a write to the transmit/receive data register l. read anytime (used in auto clearing mechanism). write has no meaning or effect. tdre ?transmit data register empty flag new data will not be transmitted unless sc0sr1 is read before writing to the transmit data register. re- set sets this bit. 0 = sc0dr busy 1 = any byte in the transmit data register is transferred to the serial shift register so new data may now be written to the transmit data register. tc ?transmit complete flag flag is set when the transmitter is idle (no data, preamble, or break transmission in progress). clear by reading sc0sr1 with tc set and then writing to sc0dr. 0 = transmitter busy 1 = transmitter is idle rdrf ?receive data register full flag once cleared, idle is not set again until the rxd line has been active and becomes idle again. rdrf is set if a received character is ready to be read from sc0dr. clear the rdrf flag by reading sc0sr1 with rdrf set and then reading sc0dr. 0 = sc0dr empty 1 = sc0dr full idle ?idle line detected flag receiver idle line is detected (the receipt of a minimum of 10/11 consecutive ones). this bit will not be set by the idle line condition when the rwu bit is set. once cleared, idle will not be set again until after rdrf has been set (after the line has been active and becomes idle again). 0 = rxd line is idle 1 = rxd line is active or ?overrun error flag new byte is ready to be transferred from the receive shift register to the receive data register and the receive data register is already full (rdrf bit is set). data transfer is inhibited until this bit is cleared. 0 = no overrun 1 = overrun detected sc0sr1 ?sci status register 1 $00c4 bit 7 6 5 4 3 2 1 bit 0 tdre tc rdrf idle or nf fe pf reset: 1 1 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 93 nf ?noise error flag set during the same cycle as the rdrf bit but not set in the case of an overrun (or). 0 = unanimous decision 1 = noise on a valid start bit, any of the data bits, or on the stop bit fe ?framing error flag set when a zero is detected where a stop bit was expected. clear the fe flag by reading sc0sr1 with fe set and then reading sc0dr. 0 = stop bit detected 1 = zero detected rather than a stop bit pf ?parity error flag indicates if received data? parity matches parity bit. this feature is active only when parity is enabled. the type of parity tested for is determined by the pt (parity type) bit in sc0cr1. 0 = parity correct 1 = incorrect parity detected read anytime. write has no meaning or effect. raf ?receiver active flag this bit is controlled by the receiver front end. it is set during the rt1 time period of the start bit search. it is cleared when an idle state is detected or when the receiver circuitry detects a false start bit (gener- ally due to noise or baud rate mismatch). 0 = a character is not being received 1 = a character is being received r8 ?receive bit 8 read anytime. write has no meaning or affect. this bit is the ninth serial data bit received when the sci system is configured for nine-data-bit opera- tion. t8 ?transmit bit 8 read or write anytime. this bit is the ninth serial data bit transmitted when the sci system is configured for nine-data-bit oper- ation. when using 9-bit data format this bit does not have to be written for each data word. the same value will be transmitted as the ninth bit until this bit is rewritten. sc0sr2 ?sci status register 2 $00c5 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 0 raf reset: 0 0 0 0 0 0 0 0 sc0drh ?sci data register high $00c6 bit 7 6 5 4 3 2 1 bit 0 r8 t8 0 0 0 0 0 0 reset: 0 0 0 0 0 0 0 0 sc0drl ?sci data register low $00c7 bit 7 6 5 4 3 2 1 bit 0 r7/t7 r6/t6 r5/t5 r4/t4 r3/t3 r2/t2 r1/t1 r0/t0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 94 MC68HC912BL16TS/d r7/t7?0/t0 ?receive/transmit data bits 7 to 0 reads access the eight bits of the read-only sci receive data register (rdr). writes access the eight bits of the write-only sci transmit data register (tdr). sc0drl:sc0drh form the 9-bit data word for the sci. if the sci is being used with a 7- or 8-bit data word, only sc0drl needs to be accessed. if a 9-bit format is used, the upper register should be written first to ensure that it is transferred to the trans- mitter shift register with the lower register. 13.3 serial peripheral interface (spi) the serial peripheral interface allows the mc68hc912bl16 to communicate synchronously with pe- ripheral devices and other microprocessors. the spi system in the mc68hc912bl16 can operate as a master or as a slave. the spi is also capable of interprocessor communications in a multiple master system. when the spi is enabled, all pins that are defined by the configuration as inputs will be inputs regardless of the state of the ddrs bits for those pins. all pins that are defined as spi outputs will be outputs only if the ddrs bits for those pins are set. any spi output whose corresponding ddrs bit is cleared can be used as a general-purpose input. a bidirectional serial pin is possible using the ddrs as the direction control. 13.3.1 spi baud rate generation the p clock is input to a divider series and the resulting spi clock rate may be selected to be p divided by 2, 4, 8, 16, 32, 64, 128 or 256. three bits in the sp0br register control the spi clock rate. this baud rate generator is activated only when spi is in the master mode and serial transfer is taking place. oth- erwise this divider is disabled to save power. 13.3.2 spi operation in the spi system the 8-bit data register in the master and the 8-bit data register in the slave are linked to form a distributed 16-bit register. when a data transfer operation is performed, this 16-bit register is serially shifted eight bit positions by the sck clock from the master so the data is effectively exchanged between the master and the slave. data written to the sp0dr register of the master becomes the output data for the slave and data read from the sp0dr register of the master after a transfer operation is the input data from the slave. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 95 figure 23 serial peripheral interface block diagram a clock phase control bit (cpha) and a clock polarity control bit (cpol) in the sp0cr1 register select one of four possible clock formats to be used by the spi system. the cpol bit simply selects non-in- verted or inverted clock. the cpha bit is used to accommodate two fundamentally different protocols by shifting the clock by one half cycle or no phase shift. pin control logic 8-bit shift register read data buffer shift control logic clock logic spi control sp0sr spi status register sp0dr spi data register divider select sp0br spi baud rate register ? 2 ? 4 ? 8 ? 16 ? 32 ? 64 ? 128 ? 256 spi interrupt internal bus mcu p clock (same as e rate) s m m s m s request lsbf spe clock mstr swom miso ps4 sck ps6 ss ps7 mosi ps5 hc12 spi block sp0cr1 spi control register 1 sp0cr2 spi control register 2 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 96 MC68HC912BL16TS/d figure 24 spi clock format 0 (cpha = 0) figure 25 spi clock format 1 (cpha = 1) t l begin end sck (cpol=0) sample i change o sel ss (o) transfer sck (cpol=1) msb first (lsbf=0) : lsb first (lsbf=1) : msb lsb lsb msb bit 5 bit 2 bit 6 bit 1 bit 4 bit 3 bit 3 bit 4 bit 2 bit 5 bit 1 bit 6 change o sel ss (i) (mosi pin) (miso pin) (master only) (mosi/miso) t t f or t t , t l , t l minimum 1/2 sck t i t l hc12 spi clock form 0 t l t t for t t , t l , t l minimum 1/2 sck t i t l begin end sck (cpol=0) sample i change o sel ss (o) transfer sck (cpol=1) msb first (lsbf=0) : lsb first (lsbf=1) : msb lsb lsb msb bit 5 bit 2 bit 6 bit 1 bit 4 bit 3 bit 3 bit 4 bit 2 bit 5 bit 1 bit 6 change o sel ss (i) (mosi pin) (miso pin) (master only) (mosi/miso) hc12 spi clock form 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 97 13.3.3 ss output available in master mode only, ss output is enabled with the ssoe bit in the sp0cr1 register if the corresponding ddrs bit is set. the ss output pin will be connected to the ss input pin of the external slave device. the ss output automatically goes low for each transmission to select the external device and it goes high during each idling state to deselect external devices. 13.3.4 bidirectional mode (momi or siso) in bidirectional mode, the spi uses only one serial data pin for external device interface. the mstr bit decides which pin to be used. the mosi pin becomes serial data i/o (momi) pin for the master mode, and the miso pin becomes serial data i/o (siso) pin for the slave mode. the direction of each serial i/o pin depends on the corresponding ddrs bit. figure 26 normal mode and bidirectional mode 13.3.5 register descriptions control and data registers for the spi subsystem are described below. the memory address indicated for each register is the default address that is in use after reset. the entire 512-byte register block can be mapped to any 2-kbyte boundary within the standard 64-kbyte address space. for more information refer to 5 operating modes and resource mapping . table 31 ss output selection dds7 ssoe master mode slave mode 0 0 ss input with modf feature ss input 0 1 reserved ss input 1 0 general-purpose output ss input 1 1 ss output ss input when spe=1 master mode mstr=1 slave mode mstr=0 normal mode spc0=0 swom enables open drain output. swom enables open drain output. bidirectional mode spc0=1 swom enables open drain output. ps4 becomes gpio. swom enables open drain output. ps5 becomes gpio. sp0cr1 ?spi control register 1 $00d0 bit 7 6 5 4 3 2 1 bit 0 spie spe swom mstr cpol cpha ssoe lsbf reset: 0 0 0 0 0 1 0 0 spi mo mi dds5 serial out serial in spi si so serial in serial out dds4 spi momi ps4 dds5 serial out serial in spi ps5 siso dds4 serial in serial out f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 98 MC68HC912BL16TS/d read or write anytime. spie ?spi interrupt enable 1 = hardware interrupt sequence is requested each time the spif or modf status flag is set 0 = spi interrupts are inhibited spe ?spi system enable 0 = spi internal hardware is initialized and spi system is in a low-power disabled state. 1 = ps[4:7] are dedicated to the spi function when modf is set, spe always reads zero. sp0cr1 must be written as part of a mode fault recovery sequence. swom ?port s wired-or mode controls not only spi output pins but also the general-purpose output pins (ps[4:7]) which are not used by spi. 0 = spi and/or ps[4:7] output buffers operate normally 1 = spi and/or ps[4:7] output buffers behave as open-drain outputs mstr ?spi master/slave mode select 0 = slave mode 1 = master mode cpol, cpha ?spi clock polarity, clock phase these two bits are used to specify the clock format to be used in spi operations. when the clock polarity bit is cleared and data is not being transferred, the sck pin of the master device is low. when cpol is set, sck idles high. see figure 24 and figure 25 . ssoe ?slave select output enable the ss output feature is enabled only in the master mode by asserting the ssoe and dds7. lsbf ?spi lsb first enable 0 = data is transferred most significant bit first 1 = data is transferred least significant bit first normally data is transferred most significant bit first. this bit does not affect the position of the msb and lsb in the data register. reads and writes of the data register will always have msb in bit 7. read or write anytime. sswai ?ssi stop in wait mode 0 = ssi clock operate normally 1 = halt ssi clock generation when in wait mode spc0 ?serial pin control 0 this bit decides serial pin configurations with mstr control bit. sp0cr2 ?spi control register 2 $00d1 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 sswai spc0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 99 read anytime. write anytime. at reset, e clock divided by 2 is selected. spr[2:0] ?spi clock (sck) rate select bits these bits are used to specify the spi clock rate. read anytime. write has no meaning or effect. spif ?spi interrupt request spif is set after the eighth sck cycle in a data transfer and it is cleared by reading the sp0sr register (with spif set) followed by an access (read or write) to the spi data register. wcol ?write collision status flag the mcu write is disabled to avoid writing over the data being transferred. no interrupt is generated because the error status flag can be read upon completion of the transfer that was in progress at the pin mode spc0 1 notes: 1. the serial pin control 0 bit enables bidirectional configurations. mstr miso 2 2. slave output is enabled if dds4 = 1, ss = 0 and mstr = 0. (#1, #3) mosi 3 3. master output is enabled if dds5 = 1 and mstr = 1. (#2, #4) sck 4 4. sck output is enabled if dds6 = 1 and mstr = 1. (#2, #4) ss 5 5. ss output is enabled if dds7 = 1, ssoe = 1 and mstr = 1. (#2, #4) #1 normal 0 0 slave out slave in sck in ss in #2 1 master in master out sck out ss i/o #3 bidirectional 1 0 slave i/o gpi/o sck in ss in #4 1 gpi/o master i/o sck out ss i/o sp0br ?spi baud rate registe r $00d2 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 spr2 spr1 spr0 reset: 0 0 0 0 0 0 0 0 table 32 spi clock rate selection spr2 spr1 spr0 e clock divisor frequency at e clock = 4 mhz frequency at e clock = 8 mhz 0 0 0 2 2.0 mhz 4.0 mhz 0 0 1 4 1.0 mhz 2.0 mhz 0 1 0 8 500 khz 1.0 mhz 0 1 1 16 250 khz 500 khz 1 0 0 32 125 khz 250 khz 1 0 1 64 62.5 khz 125 khz 1 1 0 128 31.3 khz 62.5 khz 1 1 1 256 15.6 khz 31.3 khz sp0sr ?spi status register $00d3 bit 7 6 5 4 3 2 1 bit 0 spif wcol 0 modf 0 0 0 0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 100 MC68HC912BL16TS/d time of the error. automatically cleared by a read of the sp0sr (with wcol set) followed by an access (read or write) to the sp0dr register. 0 = no write collision 1 = indicates that a serial transfer was in progress when the mcu tried to write new data into the sp0dr data register. modf ?spi mode error interrupt status flag this bit is set automatically by spi hardware if the mstr control bit is set and the slave select input pin becomes zero. this condition is not permitted in normal operation. in the case where ddrs bit 7 is set, the ps7 pin is a general-purpose output pin or ss output pin rather than being dedicated as the ss input for the spi system. in this special case the mode fault function is inhibited and modf remains cleared. this flag is automatically cleared by a read of the sp0sr (with modf set) followed by a write to the sp0cr1 register. read anytime (normally only after spif flag set). write anytime (see wcol write collision flag). reset does not affect this address. this 8-bit register is both the input and output register for spi data. reads of this register are double buffered but writes cause data to be written directly into the serial shifter. in the spi system the 8-bit data register in the master and the 8-bit data register in the slave are linked by the mosi and miso wires to form a distributed 16-bit register. when a data transfer operation is performed, this 16-bit reg- ister is serially shifted eight bit positions by the sck clock from the master so the data is effectively ex- changed between the master and the slave. note that some slave devices are very simple and either accept data from the master without returning data to the master or pass data to the master without re- quiring data from the master. 13.4 port s in all modes, port s bits ps[7:4] and ps[1:0] can be used for either general-purpose i/o, or with the sci and spi subsystems. during reset, port s pins are configured as high-impedance inputs (ddrs is cleared). ports can be read anytime. when configured as an input, a read will return the pin level. when con- figured as output, a read will return the latched output data. writes do not change pin state when pin configured for spi or sci output. after reset all bits are configured as general-purpose inputs. port s shares function with the on-chip serial systems (spi0 and sci0). read or write anytime. after reset, all general-purpose i/o are configured for input only. sp0dr ?spi data register $00d5 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 ports ?port s data register $00d6 bit 7 6 5 4 3 2 1 bit 0 ps7 ps6 ps5 ps4 ps3 ps2 ps1 ps0 pin function ss cs sck mosi momi miso siso n/a n/a txd0 rxd0 ddrs ?data direction register for port s $00d7 bit 7 6 5 4 3 2 1 bit 0 dds7 dds6 dds5 dds4 dds3 dds2 dds1 dds0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 101 0 = configure the corresponding i/o pin for input only 1 = configure the corresponding i/o pin for output dds0 ?data direction for port s bit 2 and bit 0 if the sci receiver is configured for two-wire sci operation, corresponding port s pins will be input re- gardless of the state of these bits. dds1 ?data direction for port s bit 1 if the sci transmitter is configured for two-wire sci operation, corresponding port s pins will be output regardless of the state of these bits. dds2, ddrs3 ?data direction for port s bit 2 and bit 3 port s[3:2] are not bonded out to any pin in mc68hc912bl16. dds[6:4] ?data direction for port s bits 6 through 4 if the spi is enabled and expects the corresponding port s pin to be an input, it will be an input regard- less of the state of the ddrs bit. if the spi is enabled and expects the bit to be an output, it will be an output only if the ddrs bit is set. dds7 ?data direction for port s bit 7 in spi slave mode, dds7 has no meaning or effect; the ps7 pin is dedicated as the ss input. in spi master mode, dds7 determines whether ps7 is an error detect input to the spi or a general-purpose or slave select output line. read or write anytime. note port s[3:2] are not bonded out to any pin in mc68hc912bl16. rdps2 ?reduce drive of ps[7:4] 0 = port s output drivers for bits 7 through 4 operate normally. 1 = port s output pins for bits 7 through 4 have reduced drive capability for lower power and less noise. rdps1 ?reduce drive of ps[3:2] 0 = port s output drivers for bits 3 and 2 operate normally. 1 = port s output pins for bits 3 and 2 have reduced drive capability for lower power and less noise. rdps0 ?reduce drive of ps[1:0] 0 = port s output drivers for bits 1 and 0 operate normally. 1 = port s output pins for bits 1 and 0 have reduced drive capability for lower power and less noise. pups2 ?pull-up port s enable ps[7:4] 0 = no internal pull-ups on port s bits 7 through 4. 1 = port s input pins for bits 7 through 4 have an active pull-up device. if a pin is programmed as output, the pull-up device becomes inactive. pups1 ?pull-up port s enable ps[3:2] 0 = no internal pull-ups on port s bits 3 and 2. 1 = port s input pins for bits 3 and 2 have an active pull-up device. if a pin is programmed as output, the pull-up device becomes inactive. purds ?pull-up and reduced drive for port s $00db bit 7 6 5 4 3 2 1 bit 0 0 rdps2 rdps1 rdps0 0 pups2 pups1 pups0 reset: 0 0 0 0 0 1 1 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 102 MC68HC912BL16TS/d pups0 ?pull-up port s enable ps[1:0] 0 = no internal pull-ups on port s bits 1 and 0. 1 = port s input pins for bits 1 and 0 have an active pull-up device. if a pin is programmed as output, the pull-up device becomes inactive. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 103 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 104 MC68HC912BL16TS/d 14 analog-to-digital converter the atd is an 8-channel, 10-bit, multiplexed-input successive-approximation analog-to-digital convert- er, accurate to ? least significant bit (lsb). it does not require external sample and hold circuits be- cause of the type of charge redistribution technique used. the atd converter timing is synchronized to the system p clock. the atd module consists of a 16-word (32-byte) memory-mapped control register block used for control, testing and configuration. figure 27 analog-to-digital converter block diagram 14.1 functional description a single conversion sequence consists of four or eight conversions, depending on the state of the select 8 channel mode (s8cm) bit when atdctl5 is written. there are eight basic conversion modes. in the non-scan modes, the scf bit is set after the sequence of four or eight conversions has been performed and the atd module halts. in the scan modes, the scf bit is set after the first sequence of four or eight conversions has been performed, and the atd module continues to restart the sequence. in both modes, the ccf bit associated with each register is set when that register is loaded with the appropriate conversion result. that flag is cleared automatically when that result register is read. the conversions are started by writing to the control registers. 14.2 atd registers atdctl0 ? reserved $0060 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 0 0 reset: 0 0 0 0 0 0 0 0 atd 0 atd 1 atd 2 atd 3 atd 4 atd 5 atd 6 atd 7 sar rc dac array and comparator internal bus v dda v ssa v rl v rh clock select/prescale analog mux and sample buffer amp port ad data input register an7/pad7 an6/pad6 an5/pad5 an4/pad4 an3/pad3 an2/pad2 an1/pad1 an0/pad0 reference supply hc12 atd block f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 105 the atd control register 2 and 3 are used to select the power up mode, interrupt control, and freeze control. writes to these registers abort any current conversion sequence. read or write anytime except ascif bit, which cannot be written. bit positions atdctl2[4:2] and atdctl3[7:2] are unused and always read as zeros. adpu ?atd power up 0 = disables the atd, including the analog section for reduction in power consumption. 1 = allows the atd to function normally. software can disable the clock signal to the atd converter and power down the analog circuits to re- duce power consumption. when reset to zero, the adpu bit aborts any conversion sequence in progress. because the bias currents to the analog circuits are turned off, the atd requires a period of recovery time to stabilize the analog circuits after setting the adpu bit. affc ?atd fast flag clear all 0 = atd flag clearing operates normally (read the status register before reading the result register to clear the associate ccf bit). 1 = changes all atd conversion complete flags to a fast clear sequence. any access to a result register (atd0?) will cause the associated ccf flag to clear automatically if it was set at the time. awai ?atd stop in wait mode 0 = atd continues to run when the mcu is in wait mode 1 = atd stops to save power when the mcu is in wait mode ascie ?atd sequence complete interrupt enable 0 = disables atd interrupt 1 = enables atd interrupt on sequence complete ascif ?atd sequence complete interrupt cannot be written in any mode. 0 = no atd interrupt occurred 1 = atd sequence complete frz1, frz0 ?background debug (freeze) enable (suspend module operation at breakpoint) when debugging an application, it is useful in many cases to have the atd pause when a breakpoint is encountered. these two bits determine how the atd will respond when background debug mode be- comes active. atdctl1 reserved $0061 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 0 0 reset: 0 0 0 0 0 0 0 0 atdctl2 ?atd control register 2 $0062 bit 7 6 5 4 3 2 1 bit 0 adpu affc awai 0 0 0 ascie ascif reset: 0 0 0 0 0 0 0 0 atdctl3 ?atd control register 3 $0063 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 frz1 frz0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 106 MC68HC912BL16TS/d the atd control register 4 is used to select the clock source and set up the prescaler. writes to the atd control registers initiate a new conversion sequence. if a write occurs while a conversion is in progress, the conversion is aborted and atd activity halts until a write to atdctl5 occurs. s10bm ?atd 10-bit mode control 0 = 8 bit operation 1 = 10 bit operation smp1, smp0 ?select sample time these bits are used to select one of four sample times after the buffered sample and transfer has oc- curred. total conversion time depends on initial sample time (fixed at two atd clocks), transfer time (fixed at four atd clocks), final sample time (programmable, refer to table 34 ), and resolution time (fixed at ten atd clocks). prs4, prs3, prs2, prs1, prs0 ?select divide-by factor for atd p-clock prescaler. the binary value written to these bits (1 to 31) selects the divide-by factor for the modulo counter-based prescaler. the p clock is divided by this value plus one and then fed into a ? 2 circuit to generate the atd module clock. the divide-by-two circuit insures symmetry of the output clock signal. clearing these bits causes the prescale value to default to one which results in a ? 2 prescale factor. this signal is then fed into the ? 2 logic. the reset state divides the p clock by a total of four and is appropriate for nominal operation between 2 mhz and 8 mhz bus rate. table 35 shows the divide-by operation and the appro- priate range of system clock frequencies. table 33 atd response to background debug enable frz1 frz0 atd response 0 0 continue conversions in active background mode 0 1 reserved 1 0 finish current conversion, then freeze 1 1 freeze when bdm is active atdctl4 ?atd control register 4 $0064 bit 7 6 5 4 3 2 1 bit 0 s10bm smp1 smp0 prs4 prs3 prs2 prs1 prs0 reset: 0 0 0 0 0 0 0 1 table 34 final sample time selection smp1 smp0 final sample time total 8-bit conversion time total 10-bit conversion time 0 0 2 atd clock periods 18 atd clock periods 20 atd clock periods 0 1 4 atd clock periods 20 atd clock periods 22 atd clock periods 1 0 8 atd clock periods 24 atd clock periods 26 atd clock periods 1 1 16 atd clock periods 32 atd clock periods 34 atd clock periods f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 107 the atd control register 5 is used to select the conversion modes, the conversion channel(s), and ini- tiate conversions. read or write anytime. a write to atdctl5 initiates a new conversion sequence. if a conversion se- quence is in progress when a write occurs, that sequence is aborted and the scf and ccf bits are reset. s8cm ?select 8 channel mode 0 = conversion sequence consists of four conversions 1 = conversion sequence consists of eight conversions scan ?enable continuous channel scan 0 = single conversion sequence 1 = continuous conversion sequences (scan mode) when a conversion sequence is initiated by a write to the atdctl register, the user has a choice of performing a sequence of four (or eight, depending on the s8cm bit) conversions or continuously per- forming four (or eight) conversion sequences. mult ?enable multichannel conversion 0 = atd sequencer runs all four or eight conversions on a single input channel selected via the cd, cc, cb, and ca bits. 1 = atd sequencer runs each of the four or eight conversions on sequential channels in a specific group. refer to table 36 . cd, cc, cb, and ca ?channel select for conversion table 35 clock prescaler values prescale value total divisor max p clock 1 notes: 1. maximum conversion frequency is 2 mhz. maximum p clock divisor value will become maximum conversion rate that can be used on this atd module. min p clock 2 2. minimum conversion frequency is 500 khz. minimum p clock divisor value will become minimum conversion rate that this atd can perform. 00000 ? 2 4 mhz 1 mhz 00001 ? 4 8 mhz 2 mhz 00010 ? 6 8 mhz 3 mhz 00011 ? 8 8 mhz 4 mhz 00100 ? 10 8 mhz 5 mhz 00101 ? 12 8 mhz 6 mhz 00110 ? 14 8 mhz 7 mhz 00111 ? 16 8 mhz 8 mhz 01xxx do not use 1xxxx atdctl5 ?atd control register 5 $0065 bit 7 6 5 4 3 2 1 bit 0 0 s8cm scan mult cd cc cb ca reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 108 MC68HC912BL16TS/d table 36 multichannel mode result register assignment s8cm cd cc cb ca channel signal result in adrx if mult = 1 0 0 0 0 0 an0 adr0 0 1 an1 adr1 1 0 an2 adr2 1 1 an3 adr3 0 0 1 0 0 an4 adr0 0 1 an5 adr1 1 0 an6 adr2 1 1 an7 adr3 0 1 0 0 0 reserved adr0 0 1 reserved adr1 1 0 reserved adr2 1 1 reserved adr3 0 1 1 0 0 v rh adr0 0 1 v rl adr1 1 0 (v rh + v rl )/2 adr2 1 1 test/reserved adr3 1 0 0 0 0 an0 adr0 0 0 1 an1 adr1 0 1 0 an2 adr2 0 1 1 an3 adr3 1 0 0 an4 adr4 1 0 1 an5 adr5 1 1 0 an6 adr6 1 1 1 an7 adr7 1 1 0 0 0 reserved adr0 0 0 1 reserved adr1 0 1 0 reserved adr2 0 1 1 reserved adr3 1 0 0 v rh adr4 1 0 1 v rl adr5 1 1 0 (v rh + v rl )/2 adr6 1 1 1 test/reserved adr7 shaded bits are ?on? care?if mult = 1 and the entire block of four or eight channels make up a conversion sequence. when mult = 0, all four bits (cd, cc, cb, and ca) must be specified and a conversion sequence con- sists of four or eight consecutive conversions of the single specified chan- nel. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 109 the atd status registers contain the flags indicating the completion of atd conversions. normally, it is read-only. in special mode, the scf bit and the ccf bits may also be written. scf ?sequence complete flag this bit is set at the end of the conversion sequence when in the single conversion sequence mode (scan = 0 in atdctl5) and is set at the end of the first conversion sequence when in the continuous conversion mode (scan = 1 in atdctl5). when affc = 0, scf is cleared when a write is performed to atdctl5 to initiate a new conversion sequence. when affc = 1, scf is cleared after the first result register is read. cc[2:0] ?conversion counter for current sequence of four or eight conversions this 3-bit value reflects the contents of the conversion counter pointer in a four or eight count sequence. this value also reflects which result register will be written next, indicating which channel is currently being converted. ccf[7:0] ?conversion complete flags each of these bits are associated with an individual atd result register. for each register, this bit is set at the end of conversion for the associated atd channel and remains set until that atd result register is read. it is cleared at that time if affc bit is set, regardless of whether a status register read has been performed (i.e., a status register read is not a pre-qualifier for the clearing mechanism when affc = 1). otherwise the status register must be read to clear the flag. the test registers control various special modes which are used during manufacturing. the test register can be read or written only in the special modes. in the normal modes, reads of the test register return zero and writes have no effect. sar[9:0] ?sar data reads of this byte return the current value in the sar. writes to this byte change the sar to the value written. bits sar[9:2] reflect the eight sar bits used during the resolution process for an 8-bit result. bits sar[9:0] reflect the eight sar bits used during the resolution process for an 10-bit result atdstat atd status register $0066 bit 7 6 5 4 3 2 1 bit 0 scf 0 0 0 0 cc2 cc1 cc0 reset: 0 0 0 0 0 0 0 0 atdstat ?atd status register $0067 bit 7 6 5 4 3 2 1 bit 0 ccf7 ccf6 ccf5 ccf4 ccf3 ccf2 ccf1 ccf0 reset: 0 0 0 0 0 0 0 0 atdtsth ?atd test register $0068 bit 7 6 5 4 3 2 1 bit 0 sar9 sar8 sar7 sar6 sar5 sar4 sar3 sar2 reset: 0 0 0 0 0 0 0 0 atdtstl ?atd test register $0069 bit 7 6 5 4 3 2 1 bit 0 sar1 sar0 rst tstout tst3 tst2 tst1 tst0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 110 MC68HC912BL16TS/d rst ?module reset bit when set, this bit causes all registers and activity in the module to assume the same state as out of power-on reset (except for adpu bit in atdctl2, which remains set, allowing the atd module to re- main enabled). tstout ?multiplex output of tst[3:0] (factory use) tst[3:0] ?test bits 3 to 0 (reserved) selects one of 16 reserved factory testing modes. pad[7:0] ?port ad data input bits after reset these bits reflect the state of the input pins. may be used for general-purpose digital input. when the software reads portad, it obtains the digital levels that appear on the corresponding port ad pins. pins with signals not meeting v il or v ih specifi- cations will have an indeterminate value. writes to this register have no meaning at any time. adrxh[15:8] , adrxl[7:0]?atd conversion result the reset condition for these registers is undefined. these bits contain the left justified, unsigned result from the atd conversion. when operating with 8 bit resolution, bits 15 to 8 contain the 8 bit result, bits 7 and 6 are undefined, and bits 5 through 0 are zero. when operating with 10 bit resolution, bits 15 to 6 contain the 10 bit result and bits 15 through 10 are zero for the right jistified mode. the channel from which this result was obtained is dependent on the conversion mode selected. these registers are always read-only in normal mode. portad ? port ad data input register $006f bit 7 6 5 4 3 2 1 bit 0 pad7 pad6 pad5 pad4 pad3 pad2 pad1 pad0 reset: adr0h ? atd converter result register 0 $0070 adr0l ? atd converter result register 0 $0071 adr1h ? atd converter result register 1 $0072 adr1l ? atd converter result register 1 $0073 adr2h ? atd converter result register 2 $0074 adr2l ? atd converter result register 2 $0075 adr3h ? atd converter result register 3 $0076 adr3l ? atd converter result register 3 $0077 adr4h ? atd converter result register 4 $0078 adr4l ? atd converter result register 4 $0079 adr5h ? atd converter result register 5 $007a adr5l ? atd converter result register 5 $007b adr6h ? atd converter result register 6 $007c adr6l ? atd converter result register 6 $007d adr7h ? atd converter result register 7 $007e adr7l ? atd converter result register 7 $007f addrxh bit 15 14 13 12 11 10 9 bit 8 addrxl bit 7 6 0 0 0 0 0 0 reset: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 111 14.3 atd mode operation stop ?causes all clocks to halt (if the s bit in the ccr is zero). the system is placed in a minimum- power standby mode. this aborts any conversion sequence in progress. during stop recovery, the atd must delay for the stop recovery time (t sr ) before initiating a new atd conversion sequence. wait ?atd conversion continues unless awai bit in atdctl2 register is set. bdm ?debug options available as set in register atdctl3. user ?atd continues running unless adpu is cleared. adpu ?atd operations are stopped if adpu = 0, but registers are accessible. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 112 MC68HC912BL16TS/d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 113 15 development support development support involves complex interactions between mc68hc912bl16 resources and exter- nal development systems. the following section concerns instruction queue and queue tracking sig- nals, background debug mode, breakpoints, and instruction tagging. 15.1 instruction queue it is possible to monitor cpu activity on a cycle-by-cycle basis for debugging.the cpu12 instruction queue provides at least three bytes of program information to the cpu when instruction execution be- gins. the cpu12 always completely finishes executing an instruction before beginning to execute the next instruction. status signals ipipe[1:0] provide information about data movement in the queue and indicate when the cpu begins to execute instructions. information available on the ipipe[1:0] pins is time multiplexed. external circuitry can latch data movement information on rising edges of the e-clock signal; execution start information can be latched on falling edges. table 37 shows the meaning of data on the pins. program information is fetched a few cycles before it is used by the cpu. in order to monitor cycle-by- cycle cpu activity, it is necessary to externally reconstruct what is happening in the instruction queue. internally the mcu only needs to buffer the data from program fetches. for system debug it is necessary to keep the data and its associated address in the reconstructed instruction queue. the raw signals re- quired for reconstruction of the queue are addr, data, r/w , eclk, and status signals ipipe[1:0]. the instruction queue consists of two 16-bit queue stages and a holding latch on the input of the first stage. to advance the queue means to move the word in the first stage to the second stage and move the word from either the holding latch or the data bus input buffer into the first stage. to start even (or odd) instruction means to execute the opcode in the high-order (or low-order) byte of the second stage of the instruction queue. 15.2 background debug mode background debug mode (bdm) is used for system development, in-circuit testing, field testing, and programming. bdm is implemented in on-chip hardware and provides a full set of debug options. table 37 ipipe decoding data movement ?ipipe[1:0] captured at rising edge of e clock 1 notes: 1. refers to data that was on the bus at the previous e falling edge. ipipe[1:0] mnemonic meaning 0:0 no movement 0:1 lat latch data from bus 1:0 ald advance queue and load from bus 1:1 all advance queue and load from latch execution start ?ipipe[1:0] captured at falling edge of e clock 2 2. refers to bus cycle starting at this e falling edge. ipipe[1:0] mnemonic meaning 0:0 no start 0:1 int start interrupt sequence 1:0 sev start even instruction 1:1 sod start odd instruction f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 114 MC68HC912BL16TS/d because bdm control logic does not reside in the cpu, bdm hardware commands can be executed while the cpu is operating normally. the control logic generally uses cpu dead cycles to execute these commands, but can steal cycles from the cpu when necessary. other bdm commands are firmware based, and require the cpu to be in active background mode for execution. while bdm is active, the cpu executes a firmware program located in a small on-chip rom that is available in the standard 64- kbyte memory map only while bdm is active. the bdm control logic communicates with an external host development system serially, via the bkgd pin. this single-wire approach minimizes the number of pins needed for development support. 15.2.1 bdm serial interface the bdm serial interface requires the external controller to generate a falling edge on the bkgd pin to indicate the start of each bit time. the external controller provides this falling edge whether data is trans- mitted or received. bkgd is a pseudo-open-drain pin that can be driven either by an external controller or by the mcu. data is transferred msb first at 16 e-clock cycles per bit (nominal speed). the interface times out if 512 e-clock cycles occur between falling edges from the host. the hardware clears the command register when this time-out occurs. the bkgd pin can receive a high or low level or transmit a high or low level. the following diagrams show timing for each of these cases. interface timing is synchronous to mcu clocks but asynchronous to the external host. the internal clock signal is shown for reference in counting cycles. figure 28 shows an external host transmitting a logic one or zero to the bkgd pin of a target m68hc12 mcu. the host is asynchronous to the target so there is a 0-to-1 cycle delay from the host-generated falling edge to where the target perceives the beginning of the bit time. ten target e cycles later, the target senses the bit level on the bkgd pin. typically the host actively drives the pseudo-open-drain bkgd pin during host-to-target transmissions to speed up rising edges. since the target does not drive the bkgd pin during this period, there is no need to treat the line as an open-drain signal during host- to-target transmissions. figure 28 bdm host to target serial bit timing hc12a4 bdm host t o target tim earliest start of next bit target senses bit 10 cycles synchronization uncertainty e clock (target mcu) host transmit 1 host transmit 0 perceived start of bit time f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 115 figure 29 bdm target to host serial bit timing (logic 1) figure 29 shows the host receiving a logic one from the target mc68hc912bl16 mcu. since the host is asynchronous to the target mcu, there is a 0-to-1 cycle delay from the host-generated falling edge on bkgd to the perceived start of the bit time in the target mcu. the host holds the bkgd pin low long enough for the target to recognize it (at least two target e cycles). the host must release the low drive before the target mcu drives a brief active-high speed-up pulse seven cycles after the perceived start of the bit time. the host should sample the bit level about ten cycles after it started the bit time. figure 30 bdm target to host serial bit timing (logic 0) figure 30 shows the host receiving a logic zero from the target mc68hc912bl16 mcu. since the host is asynchronous to the target mcu, there is a 0-to-1 cycle delay from the host-generated falling edge hc12a4 bdm t arget t o host tim 1 high-impedance high-impedance high-impedance earliest start of next bit r-c rise 10 cycles 10 cycles host samples bkgd pin perceived start of bit time bkgd pin e clock (target mcu) host drive t o bkgd pin target mcu speedup pulse hc12a4 bdm t arget t o host tim 0 earliest start of next bit e clock (target mcu) host drive t o bkgd pin bkgd pin perceived start of bit time 10 cycles 10 cycles host samples bkgd pin target mcu drive and speedup pulse speedup pulse high-impedance f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 116 MC68HC912BL16TS/d on bkgd to the start of the bit time as perceived by the target mcu. the host initiates the bit time but the target mc68hc912bl16 finishes it. since the target wants the host to receive a logic zero, it drives the bkgd pin low for 13 e-clock cycles, then briefly drives it high to speed up the rising edge. the host samples the bit level about ten cycles after starting the bit time. 15.2.2 enabling bdm firmware commands bdm is available in all operating modes, but must be made active before firmware commands can be executed. bdm is enabled by setting the enbdm bit in the bdm status register via the single wire interface (using a hardware command; write_bd_byte at $ff01). bdm must then be activated to map bdm registers and rom to addresses $ff00 to $ffff and to put the mcu in active background mode. after the firmware is enabled, bdm can be activated by the hardware background command, by the bdm tagging mechanism, or by the cpu bgnd instruction. an attempt to activate bdm before firm- ware has been enabled causes the mcu to resume normal instruction execution after a brief delay. bdm becomes active at the next instruction boundary following execution of the bdm background command, but tags activate bdm before a tagged instruction is executed. in special single-chip mode, background operation is enabled and active immediately out of reset. this active case replaces the m68hc11 boot function, and allows programming a system with blank mem- ory. while bdm is active, a set of bdm control registers are mapped to addresses $ff00 to $ff06. the bdm control logic uses these registers which can be read anytime by bdm logic, not user programs. refer to 15.2.4 bdm registers for detailed descriptions. some on-chip peripherals have a bdm control bit which allows suspending the peripheral function dur- ing bdm. for example, if the timer control is enabled, the timer counter is stopped while in bdm. once normal program flow is continued, the timer counter is re-enabled to simulate real-time operations. 15.2.3 bdm commands all bdm command opcodes are eight bits long, and can be followed by an address and/or data, as in- dicated by the instruction. these commands do not require the cpu to be in active bdm mode for ex- ecution. the host controller must wait 150 cycles for a non-intrusive bdm command to execute before another command can be sent. this delay includes 128 cycles for the maximum delay for a dead cycle. for data read commands, the host must insert this delay between sending the address and attempting to read the data. bdm logic retains control of the internal buses until a read or write is completed. if an operation can be completed in a single cycle, it does not intrude on normal cpu operation. however, if an operation re- quires multiple cycles, cpu clocks are frozen until the operation is complete. there are two types of bdm commands: hardware and firmware. hardware commands allow target system memory to be read or written. target system memory includes all memory that is accessible by the cpu12 including on-chip ram, eeprom, on-chip i/o and control registers, and external memory connected to the target hc12 mcu. hardware commands are implemented in hardware logic and do not require the hc12 mcu to be in bdm mode for execution. the control logic watches the cpu12 bus- es to find a free bus cycle to execute the command so that the background access does not disturb the running application programs. if a free cycle is not found within 128 e-clock cycles, the cpu12 is mo- mentarily frozen so the control logic can steal a cycle. refer to table 38 for commands implemented in bdm control logic. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 117 the second type of bdm commands are called ?mware commands because they are implemented in a small rom within the hc12 mcu. the cpu must be in background mode to execute firmware com- mands. the usual way to get to background mode is by the hardware command background. the bdm rom is located at $ff20 to $ffff while bdm is active. there are also seven bytes of bdm reg- isters which are located at $ff00 to $ff06 while bdm is active. the cpu executes code from this rom to perform the requested operation. the bdm ?mware watches for serial commands and executes them as they are received. the ?mware commands are shown in table 39 . table 38 bdm hardware commands command opcode (hex) data description background 90 none enter background mode (if firmware enabled). read_bd_byte e4 16-bit address 16-bit data out read from memory with bdm in map (may steal cycles if external access) data for odd address on low byte, data for even address on high byte. status 1 notes: 1. status command is a specific case of the read_bd_byte command. e4 ff01, 0000 0000 (out) read_bd_byte $ff01. running user code (bgnd instruction is not allowed). ff01, 1000 0000 (out) read_bd_byte $ff01. bgnd instruction is allowed. ff01, 1100 0000 (out) read_bd_byte $ff01. background mode active (waiting for single wire serial command). read_bd_word ec 16-bit address 16-bit data out read from memory with bdm in map (may steal cycles if external access) must be aligned access. read_byte e0 16-bit address 16-bit data out read from memory with bdm out of map (may steal cy- cles if external access) data for odd address on low byte, data for even address on high byte. read_word e8 16-bit address 16-bit data out read from memory with bdm out of map (may steal cy- cles if external access) must be aligned access. write_bd_byte c4 16-bit address 16-bit data in write to memory with bdm in map (may steal cycles if external access) data for odd address on low byte, data for even address on high byte. enable_ firmware 2 2. enable_firmware is a specific case of the write_bd_byte command. c4 ff01, 1xxx xxxx(in) write byte $ff01, set the enbdm bit. this allows exe- cution of commands which are implemented in firm- ware. typically, read status, or in the msb, write the result back to status. write_bd_word cc 16-bit address 16-bit data in write to memory with bdm in map (may steal cycles if external access) must be aligned access. write_byte c0 16-bit address 16-bit data in write to memory with bdm out of map (may steal cycles if external access) data for odd address on low byte, data for even address on high byte. write_word c8 16-bit address 16-bit data in write to memory with bdm out of map (may steal cycles if external access) must be aligned access. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 118 MC68HC912BL16TS/d each of the hardware and firmware bdm commands start with an 8-bit command code (opcode). de- pending upon the commands, a 16-bit address and/or a 16-bit data word is required as indicated in the tables by the command. all the read commands output 16-bits of data despite the byte/word implication in the command name. the external host should wait 150 e-clock cycles for a non-intrusive bdm command to execute before another command is sent. this delay includes 128 e-clock cycles for the maximum delay for a free cy- cle. for data read commands, the host must insert this delay between sending the address and attempt- ing to read the data. ( in the case of a write command, the host must delay after the data portion, before sending a new command, to be sure the write has finished. the external host should delay about 32 target e-clock cycles between a firmware read command and the data portion of these commands. this allows the bdm firmware to execute the instructions needed to get the requested data into the bdm shifter register. the external host should delay about 32 target e-clock cycles after the data portion of firmware write commands to allow bdm firmware to complete the requested write operation before a new serial com- mand disturbs the bdm shifter register. the external host should delay about 64 target e-clock cycles after a trace1 or go command before starting any new serial command. this delay is needed because the bdm shifter register is used as a temporary data holding register during the exit sequence to user code. bdm logic retains control of the internal buses until a read or write is completed. if an operation can be completed in a single cycle, it does not intrude on normal cpu12 operation. ( however, if an operation requires multiple cycles, cpu12 clocks are frozen until the operation is complete. table 39 bdm firmware commands command opcode (hex) data description read_next 62 16-bit data out x = x + 2; read next word pointed-to by x read_pc 63 16-bit data out read program counter read_d 64 16-bit data out read d accumulator read_x 65 16-bit data out read x index register read_y 66 16-bit data out read y index register read_sp 67 16-bit data out read stack pointer write_next 42 16-bit data in x = x + 2; write next word pointed-to by x write_pc 43 16-bit data in write program counter write_d 44 16-bit data in write d accumulator write_x 45 16-bit data in write x index register write_y 46 16-bit data in write y index register write_sp 47 16-bit data in write stack pointer go 08 none go to user program trace1 10 none execute one user instruction then return to bdm taggo 18 none enable tagging and go to user program f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 119 15.2.4 bdm registers seven bdm registers are mapped into the standard 64-kbyte address space when bdm is active. map- ping is shown in table 40 . the content of the instruction register is determined by the type of background command being executed. the status register indicates bdm operating conditions. the shift register contains data being received or transmitted via the serial interface. the address register is temporary storage for bdm commands. the ccrsav register preserves the content of the cpu12 ccr while bdm is active. the only registers of interest to users are the status register and the ccrsav register. the other bdm registers are only used by the bdm firmware to execute commands. the registers are accessed by means of the hardware read_bd and write_bd commands, but should not be written during bdm operation (except the ccrsav register which could be written to modify the ccr value). the instruction register is written by the bdm hardware as a result of serial data shifted in on the bkgd pin. it is readable and writable in special peripheral mode on the parallel bus. it is discussed here for two conditions: when a hardware command is executed and when a firmware command is executed. the instruction register can be read or written in all modes. the hardware clears the instruc- tion register if 512 e-clock cycles occur between falling edges from the host. the bits in the bdm instruction register have the following meanings when a hardware command is executed. h/f ?hardware/firmware flag 0 = firmware instruction 1 = hardware instruction data ?data flag indicates that data accompanies the command. 0 = no data 1 = data included in command r/w ?read/write flag 0 = write 1 = read bkgnd ?hardware request to enter active background mode table 40 bdm registers address register $ff00 bdm instruction register $ff01 bdm status register $ff02?ff03 bdm shift register $ff04?ff05 bdm address register $ff06 bdm ccr holding register instruction ?bdm instruction register (hardware command) (bdm) $ff00 bit 7 6 5 4 3 2 1 bit 0 h/f data r/w bkgnd w/b bd/u 0 0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 120 MC68HC912BL16TS/d 0 = not a hardware background command 1 = hardware background command (instruction = $90) w/b ?word/byte transfer flag 0 = byte transfer 1 = word transfer bd/u ?bdm map/user map flag indicates whether bdm registers and rom are mapped to addresses $ff00 to $ffff in the standard 64-kbyte address space. used only by hardware read/write commands. 0 = bdm resources not in map 1 = bdm resources in map the bits in the bdm instruction register have the following meanings when a firmware command is ex- ecuted. h/f ?hardware/firmware flag 0 = firmware control logic 1 = hardware control logic data ?data flag 0 = no data 1 = data included in command r/w ?read/write flag 0 = write 1 = read ttago ?trace, tag, go field regn ?register/next field indicates which register is being affected by a command. in the case of a read_next or write_next command, index register x is pre-incremented by 2 and the word pointed to by x is then read or written. instruction ?bdm instruction register (firmware command) (bdm) $ff00 bit 7 6 5 4 3 2 1 bit 0 h/f data r/w ttago regn reset: 0 0 0 0 0 0 0 0 table 41 ttago decoding ttago value instruction 00 01 go 10 trace1 11 taggo table 42 regn decoding regn value instruction 000 001 010 read/write next 011 pc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 121 this register can be read or written by bdm commands or firmware. enbdm ?enable bdm (permit active background debug mode) 0 = bdm cannot be made active (hardware commands still allowed) 1 = bdm can be made active to allow firmware commands bdmact ?background mode active status bdmact becomes set as active bdm mode is entered so that the bdm firmware rom is enabled and put into the map. bdmact is cleared by a carefully timed store instruction in the bdm firmware as part of the exit sequence to return to user code and remove the bdm memory from the map. this bit has 4 clock cycles write delay. 0 = bdm not active; bdm rom and registers are not in map 1 = bdm active and waiting for serial commands; bdm rom and registers are in map care should be taken that the bdmact bit is not unintentionally changed with the write_next firm- ware command. if it is unintentionally changed from 1 to 0, it will cause a system runaway as it will dis- able the bdm firmware rom while the cpu12 is executing bdm firmware.the following two commands show how bdmact may unintentionally get changed from 1 to 0. write_x with data $fefe write_next with data $c400 the first command writes the data $fefe to the x index register.the second command writes the data $c4 to the $ff00 instruction register and also writes the data $00 to the $ff01 status register. entag ?instruction tagging enable set by the taggo instruction and cleared when bdm is entered. the serial system is disabled and the tag function enabled 16 cycles after this bit is written. 0 = tagging not enabled, or bdm active 1 = tagging active (bdm cannot process serial commands while tagging is active.) sdv ?shifter data valid shows that valid data is in the serial interface shift register. used by bdm firmware. 0 = no valid data 1 = valid data trace ?asserted by the trace1 instruction 100 d 101 x 110 y 111 sp status ?bdm status register (bdm) $ff01 bit 7 6 5 4 3 2 1 bit 0 enbdm bdmact entag sdv trace 0 0 0 reset 0 1 notes: 1. enbdm is set to 1 by the firmware in special single chip mode. 1 0 0 0 0 0 0 sp sing chip & peripheral reset: 0 0 0 0 0 0 0 0 all other modes table 42 regn decoding regn value instruction f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 122 MC68HC912BL16TS/d the 16-bit shifter register contains data being received or transmitted via the serial interface. it is also used by the bdm firmware for temporary storage. the register can be read or written in all modes but is not normally accessed by users. the 16-bit address register is temporary storage for bdm hardware and firmware commands. the register can be read in all modes but is not normally accessed by users. it is written only by bdm hard- ware. the ccrsav register is used to save the ccr of the users program when entering bdm. it is also used for temporary storage in the bdm firmware. the register is initialized by the firmware to equal the cpu ccr register. 15.3 breakpoints hardware breakpoints are used to debug software on the mc68hc912bl16 by comparing actual ad- dress and data values to predetermined data in setup registers. a successful comparison will place the cpu in background debug mode (bdm) or initiate a software interrupt (swi). breakpoint features de- signed into the mc68hc912b32 include: ?mode selection for bdm or swi generation ?program fetch tagging for cycle of execution breakpoint ?second address compare in dual address modes ?range compare by disable of low byte address ?data compare in full feature mode for non-tagged breakpoint ?byte masking for high/low byte data compares ?r/w compare for non-tagged compares ?tag inhibit on bdm trace 15.3.1 breakpoint modes three modes of operation determine the type of breakpoint in effect. ?dual address-only breakpoints, each of which will cause a software interrupt (swi) shifter ?bdm shift register (bdm) $ff02, $ff03 bit 15 14 13 12 11 10 9 bit 8 s15 s14 s13 s12 s11 s10 s9 s8 bit 7 6 5 4 3 2 1 bit 0 s7 s6 s5 s4 s3 s2 s1 s0 address ?bdm address register (bdm) $ff04, $ff05 bit 15 14 13 12 11 10 9 bit 8 a15 a14 a13 a12 a11 a10 a9 a8 bit 7 6 5 4 3 2 1 bit 0 a7 a6 a5 a4 a3 a2 a1 a0 ccrsav ?bdm ccr holding register (bdm) $ff06 bit 7 6 5 4 3 2 1 bit 0 ccr7 ccr6 ccr5 ccr4 ccr3 ccr2 ccr1 ccr0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 123 ?single full-feature breakpoint which will cause the part to enter background debug mode (bdm) ?dual address-only breakpoints, each of which will cause the part to enter bdm breakpoints will not occur when bdm is active. 15.3.1.1 swi dual address mode in this mode, dual address-only breakpoints can be set, each of which cause a software interrupt. this is the only breakpoint mode which can force the cpu to execute a swi. program fetch tagging is the default in this mode; data breakpoints are not possible. in the dual mode each address breakpoint is affected by the respective bkale bit. the bkxrw, bkxrwe, bkmbh and bkmbl bits are ignored. in dual address mode the bkdbe becomes an enable for the second address breakpoint. 15.3.1.2 bdm full breakpoint mode this is a single full-featured breakpoint which causes the part to enter background debug mode. bk1ale, bk1rw, and bk1rwe have no meaning in full breakpoint mode. bkdbe enables data compare but has no meaning if bkpm=1. bkmbh and bkmbl allow masking of high and low byte compares but has no meaning if bkpm=1. bk0ale enables compare of low address byte. ?breakpoints are not allowed if the bdm mode is already active. active mode means the cpu is executing out of the bdm rom. ?bdm should not be entered from a breakpoint unless the enable bit is set in the bdm. this is important because even if the enable bit in the bdm is negated the cpu actually does execute the bdm rom code. it checks the enable and returns if not set. if the bdm is not serviced by the monitor then the breakpoint would be re-asserted when the bdm returns to normal cpu flow. there is no hardware to enforce restriction of breakpoint operation if the bdm is not enabled. 15.3.1.3 bdm dual address mode dual address-only breakpoints, each of which cause the part to enter background debug mode. in the dual mode each address breakpoint is affected by the bkpm bit, the bkxale bits, and the bkxrw and bkxrwe bits. in dual address mode the bkdbe becomes an enable for the second address break- point. the bkmbh and bkmbl bits will have no effect when in a dual address mode. bdm mode may be entered by a breakpoint only if an internal signal from the bdm indicates background debug mode is enabled. if bkpm = 1 then bkxrw, bkxrwe, bkmbh and bkmbl have no meaning. ?breakpoints are not allowed if the bdm mode is already active. active mode means the cpu is executing out of the bdm rom. ?bdm should not be entered from a breakpoint unless the enable bit is set in the bdm. this is important because even if the enable bit in the bdm is negated the cpu actually does execute the bdm rom code. it checks the enable and returns if not set. if the bdm is not serviced by the monitor then the breakpoint would be re-asserted when the bdm returns to normal cpu flow. there is no hardware to enforce restriction of breakpoint operation if the bdm is not enabled. 15.3.2 registers breakpoint operation consists of comparing data in the breakpoint address registers (brkah/brkal) to the address bus and comparing data in the breakpoint data registers (brkdh/brkdl) to the data bus. the breakpoint data registers can also be compared to the address bus. the scope of comparison can be expanded by ignoring the least significant byte of address or data matches. the scope of comparison can be limited to program data only by setting the bkpm bit in breakpoint con- trol register 0. to trace program flow, setting the bkpm bit causes address comparison of program data only. control bits are also available that allow checking read/write matches. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 124 MC68HC912BL16TS/d read and write anytime. this register is used to control the breakpoint logic. bken1, bken0 ?breakpoint mode enable bkpm ?break on program addresses this bit controls whether the breakpoint will cause an immediate data breakpoint (next instruction boundary) or a delayed program breakpoint related to an executable opcode. data and unexecuted op- codes cannot cause a break if this bit is set. this bit has no meaning in swi dual address mode. the swi mode only performs program breakpoints. 0 = on match, break at the next instruction boundary 1 = on match, break if the match is an instruction that will be executed. this uses tagging as its breakpoint mechanism. bk1ale ?breakpoint 1 range control only valid in dual address mode. 0 = brkdl will not be used to compare to the address bus. 1 = brkdl will be used to compare to the address bus. bk0ale ?breakpoint 0 range control valid in all modes. 0 = brkal will not be used to compare to the address bus. 1 = brkal will be used to compare to the address bus. this register is read/write in all modes. brkct0 ?breakpoint control register 0 $0020 bit 7 6 5 4 3 2 1 bit 0 bken1 bken0 bkpm 0 bk1ale bk0ale 0 0 reset: 0 0 0 0 0 0 0 0 table 43 breakpoint mode control bken1 bken0 mode selected brkah/l usage brkdh/l usage r/w range 0 0 breakpoints off 0 1 swi ?dual address mode address match address match no yes 1 0 bdm ?full breakpoint mode address match data match yes yes 1 1 bdm ?dual address mode address match address match yes yes table 44 breakpoint address range control bk1ale bk0ale address range selected 0 upper 8-bit address only for full mode or dual mode bkp0 1 full 16-bit address for full mode or dual mode bkp0 0 upper 8-bit address only for dual mode bkp1 1 full 16-bit address for dual mode bkp1 brkct1 ?breakpoint control register 1 $0021 bit 7 6 5 4 3 2 1 bit 0 0 bkdbe bkmbh bkmbl bk1rwe bk1rw bk0rwe bk0rw reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 125 bkdbe ?enable data bus enables comparing of address or data bus values using the brkdh/l registers. 0 = brkdh/l registers are not used in any comparison 1 = brkdh/l registers are used to compare address or data (depending upon the mode selections bken1,0) bkmbh ?breakpoint mask high disables the comparing of the high byte of data when in full breakpoint mode. used in conjunction with the bkdbe bit (which should be set) 0 = high byte of data bus (bits 15:8) are compared to brkdh 1 = high byte is not used to in comparisons bkmbl ?breakpoint mask low disables the matching of the low byte of data when in full breakpoint mode. used in conjunction with the bkdbe bit (which should be set) 0 = low byte of data bus (bits 7:0) are compared to brkdl 1 = low byte is not used to in comparisons. bk1rwe ?r/w compare enable enables the comparison of the r/w signal to further specify what causes a match. this bit is not useful in program breakpoints or in full breakpoint mode. this bit is used in conjunction with a second address in dual address mode when bkdbe=1. 0 = r/w is not used in comparisons 1 = r/w is used in comparisons bk1rw ?r/w compare value when bk1rwe = 1, this bit determines the type of bus cycle to match. 0 = a write cycle will be matched 1 = a read cycle will be matched bk0rwe ?r/w compare enable enables the comparison of the r/w signal to further specify what causes a match. this bit is not useful in program breakpoints. 0 = r/w is not used in the comparisons 1 = r/w is used in comparisons bk0rw ?r/w compare value when bk0rwe = 1, this bit determines the type of bus cycle to match on. 0 = write cycle will be matched 1 = read cycle will be matched table 45 breakpoint read/write control bk1rwe bk1rw bk0rwe bk0rw read/write selected 0 x r/w is don? care for full mode or dual mode bkp0 1 0 r/w is write for full mode or dual mode bkp0 1 1 r/w is read for full mode or dual mode bkp0 0 x r/w is don? care for dual mode bkp1 1 0 r/w is write for dual mode bkp1 1 1 r/w is read for dual mode bkp1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 126 MC68HC912BL16TS/d these bits are used to compare against the most significant byte of the address bus. these bits are used to compare against the least significant byte of the address bus. these bits may be excluded from being used in the match if bk0ale = 0. these bits are compared to the most significant byte of the data bus in full breakpoint mode or the most significant byte of the address bus in dual address modes. bken[1:0], bkdbe, and bkmbh control how this byte will be used in the breakpoint comparison. these bits are compared to the least significant byte of the data bus in full breakpoint mode or the least significant byte of the address bus in dual address modes. bken[1:0], bkdbe, bk1ale, and bkmbl control how this byte will be used in the breakpoint comparison. note after a power-on reset, registers brkah, brkal, brkdh, and brkdl are cleared but these registers are not affected by normal resets. 15.4 instruction tagging the instruction queue and cycle-by-cycle cpu activity can be reconstructed in real time or from trace history that was captured by a logic analyzer. however, the reconstructed queue cannot be used to stop the cpu at a specific instruction, because execution has already begun by the time an operation is vis- ible outside the mcu. a separate instruction tagging mechanism is provided for this purpose. executing the bdm taggo command configures two mcu pins for tagging. tagging information is latched on the falling edge of eclk along with program information as it is fetched. tagging is allowed brkah ?breakpoint address register, high byte $0022 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 power-on reset: 0 0 0 0 0 0 0 0 brkal ?breakpoint address register, low byte $0023 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 power-on reset: 0 0 0 0 0 0 0 0 brkdh ?breakpoint data register, high byte $0024 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 power-on reset: 0 0 0 0 0 0 0 0 brkdl ?breakpoint data register, low byte $0025 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 power-on reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc912bl16 motorola MC68HC912BL16TS/d 127 in all modes. tagging is disabled when bdm becomes active and bdm serial commands cannot be pro- cessed while tagging is active. taghi is a shared function of the bkgd pin. taglo is a shared function of the pe3/lstrb pin, a multiplexed i/o pin. for 1/4 cycle before and after the rising edge of the e clock, this pin is the lstrb driven output. taglo and taghi inputs are captured at the falling edge of the e clock. a logic zero on taghi and/ or taglo marks (tags) the instruction on the high and/or low byte of the program word that was on the data bus at the same falling edge of the e clock. table 46 shows the functions of the two tagging pins. the pins operate independently; the state of one pin does not affect the function of the other. the presence of logic level zero on either pin at the fall of eclk performs the indicated function. tagging is allowed in all modes. tagging is disabled when bdm becomes active and bdm serial commands are not processed while tagging is active. the tag follows the information in the queue as the queue is advanced. when a tagged instruction reaches the head of the queue, the cpu enters active background debugging mode rather than exe- cuting the instruction. this is the mechanism by which a development system initiates hardware break- points. table 46 tag pin function taghi taglo tag 1 1 no tag 1 0 low byte 0 1 high byte 0 0 both bytes f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68hc912bl16 128 MC68HC912BL16TS/d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .


▲Up To Search▲   

 
Price & Availability of MC68HC912BL16TS

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X